aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f2e357d..5abd4b8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3294,7 +3294,10 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
0) instead of a real line. */
if (prev && prev->line
- && (!best || prev->unrelocated_pc () > best->unrelocated_pc ()))
+ && (!best || prev->unrelocated_pc () > best->unrelocated_pc ()
+ || (prev->unrelocated_pc () == best->unrelocated_pc ()
+ && (best->pc (objfile) == pc
+ ? !best->is_stmt : best->is_weak))))
{
best = prev;
best_symtab = iter_s;
@@ -3322,7 +3325,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
&& (tmp - 1)->unrelocated_pc () == tmp->unrelocated_pc ()
&& (tmp - 1)->line != 0 && !tmp->is_stmt)
--tmp;
- if (tmp->is_stmt)
+ if (tmp->is_stmt && (tmp->pc (objfile) == pc || !tmp->is_weak))
best = tmp;
}
@@ -3346,18 +3349,14 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
We used to return alt->line - 1 here, but that could be
anywhere; if we don't have line number info for this PC,
don't make some up. */
- val.pc = pc;
- }
- else if (best->line == 0)
- {
- /* If our best fit is in a range of PC's for which no line
- number info is available (line number is zero) then we didn't
- find any valid line information. */
+ if (notcurrent)
+ pc++;
val.pc = pc;
}
else
{
val.is_stmt = best->is_stmt;
+ val.is_weak = best->is_weak;
val.symtab = best_symtab;
val.line = best->line;
val.pc = best->pc (objfile);