From 1ee24f278e993baa8b732aa8b600dc0369210e3d Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 20 Mar 2002 19:15:30 +0000 Subject: 2002-03-20 Daniel Jacobowitz * 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. --- bfd/syms.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'bfd/syms.c') 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; } -- cgit v1.1