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.
This commit is contained in:
Daniel Jacobowitz 2002-03-20 19:15:30 +00:00
parent 51b9608c3a
commit 1ee24f278e
3 changed files with 75 additions and 19 deletions

View file

@ -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;
}