2005-12-31 H.J. Lu PR binutils/2096 * dwarf2.c (comp_unit_contains_address): Update comment. (_bfd_dwarf2_find_nearest_line): Return TRUE only if both comp_unit_contains_address and comp_unit_find_nearest_line return TRUE. --- bfd/dwarf2.c.unit 2005-12-31 09:12:48.000000000 -0800 +++ bfd/dwarf2.c 2005-12-31 11:49:06.000000000 -0800 @@ -2006,7 +2006,9 @@ parse_comp_unit (bfd *abfd, return unit; } -/* Return TRUE if UNIT contains the address given by ADDR. */ +/* Return TRUE if UNIT may contain the address given by ADDR. We need + to consult the line info table to see if a compilation unit really + contains the given address. */ static bfd_boolean comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr) @@ -2293,16 +2295,16 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd /* Check the previously read comp. units first. */ for (each = stash->all_comp_units; each; each = each->next_unit) - if (comp_unit_contains_address (each, addr)) - return comp_unit_find_nearest_line (each, addr, filename_ptr, - functionname_ptr, linenumber_ptr, - stash); + if (comp_unit_contains_address (each, addr) + && comp_unit_find_nearest_line (each, addr, filename_ptr, + functionname_ptr, + linenumber_ptr, stash)) + return TRUE; /* Read each remaining comp. units checking each as they are read. */ while (stash->info_ptr < stash->info_ptr_end) { bfd_vma length; - bfd_boolean found; unsigned int offset_size = addr_size; bfd_byte *info_ptr_unit = stash->info_ptr; @@ -2358,25 +2360,14 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd unit->high == 0), we need to consult the line info table to see if a compilation unit contains the given address. */ - if (each->arange.high > 0) - { - if (comp_unit_contains_address (each, addr)) - return comp_unit_find_nearest_line (each, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr, - stash); - } - else - { - found = comp_unit_find_nearest_line (each, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr, - stash); - if (found) - return TRUE; - } + if ((each->arange.high == 0 + || comp_unit_contains_address (each, addr)) + && comp_unit_find_nearest_line (each, addr, + filename_ptr, + functionname_ptr, + linenumber_ptr, + stash)) + return TRUE; } } }