aboutsummaryrefslogtreecommitdiff
path: root/bfd/syms.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2002-03-20 19:15:30 +0000
committerDaniel Jacobowitz <drow@false.org>2002-03-20 19:15:30 +0000
commit1ee24f278e993baa8b732aa8b600dc0369210e3d (patch)
treecdbb3987b14ce057dc4c5ae824faea0a6a1c58e5 /bfd/syms.c
parent51b9608c3acc602ef72802af90521aa42e2ea44b (diff)
downloadgdb-1ee24f278e993baa8b732aa8b600dc0369210e3d.zip
gdb-1ee24f278e993baa8b732aa8b600dc0369210e3d.tar.gz
gdb-1ee24f278e993baa8b732aa8b600dc0369210e3d.tar.bz2
2002-03-20 Daniel Jacobowitz <drow@mvista.com>
* dwarf2.c (struct funcinfo): Move up. (lookup_address_in_function_table): New argument function_ptr. Set it. (lookup_address_in_line_table): New argument function. If function is non-NULL, use it to handle ``addr'' before the first line note of the function. (comp_unit_find_nearest_line): Update and swap calls to lookup_address_in_function_table and lookup_address_in_line_table. * syms.c (_bfd_stab_section_find_nearest_line): Use the first N_SLINE encountered if we see an N_FUN before any N_SLINE.
Diffstat (limited to 'bfd/syms.c')
-rw-r--r--bfd/syms.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/bfd/syms.c b/bfd/syms.c
index f0ffaa5..4309c0d 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -1238,9 +1238,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
for (; stab < (indexentry+1)->stab; stab += STABSIZE)
{
- boolean done;
+ boolean done, saw_line, saw_func;
bfd_vma val;
+ saw_line = false;
+ saw_func = false;
done = false;
switch (stab[TYPEOFF])
@@ -1261,7 +1263,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
/* A line number. The value is relative to the start of the
current function. */
val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
- if (val <= offset)
+ /* If this line starts before our desired offset, or if it's
+ the first line we've been able to find, use it. The
+ !saw_line check works around a bug in GCC 2.95.3, which emits
+ the first N_SLINE late. */
+ if (!saw_line || val <= offset)
{
*pline = bfd_get_16 (abfd, stab + DESCOFF);
@@ -1274,11 +1280,14 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
}
if (val > offset)
done = true;
+ saw_line = true;
break;
case N_FUN:
case N_SO:
- done = true;
+ if (saw_func || saw_line)
+ done = true;
+ saw_func = true;
break;
}