aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 06b32c0..6d3732a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4159,8 +4159,15 @@ find_epilogue_using_linetable (CORE_ADDR func_addr)
/* While the standard allows for multiple points marked with epilogue_begin
in the same function, for performance reasons, this function will only
- find the last address that sets this flag for a given block. */
- const struct symtab_and_line sal = find_pc_line (start_pc, 0);
+ find the last address that sets this flag for a given block.
+
+ The lines of a function can be described by several line tables in case
+ there are different files involved. There's a corner case where a
+ function epilogue is in a different file than a function start, and using
+ start_pc as argument to find_pc_line will mean we won't find the
+ epilogue. Instead, use "end_pc - 1" to maximize our chances of picking
+ the line table containing an epilogue. */
+ const struct symtab_and_line sal = find_pc_line (end_pc - 1, 0);
if (sal.symtab != nullptr && sal.symtab->language () != language_asm)
{
struct objfile *objfile = sal.symtab->compunit ()->objfile ();