diff --git a/gdb/symtab.c b/gdb/symtab.c index 0ddb25f2879..bd3d55eecb0 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2905,6 +2905,13 @@ find_sal_for_pc_sect (CORE_ADDR pc, struct obj_section *section, int notcurrent) CORE_ADDR best_end = 0; struct symtab *best_symtab = 0; + if (section == nullptr) + { + section = find_pc_overlay (pc); + if (section == nullptr) + section = find_pc_section (pc); + } + /* Store here the first line number of a file which contains the line at the smallest pc after PC. If we don't find a line whose range contains PC, @@ -3030,6 +3037,7 @@ find_sal_for_pc_sect (CORE_ADDR pc, struct obj_section *section, int notcurrent) if (notcurrent) pc++; val.pc = pc; + val.section = section; return val; }