This is the mail archive of the
mailing list for the binutils project.
Re: _bfd_dwarf2_find_nearest_line returns wrong filename
- From: Nick Clifton <nickc at redhat dot com>
- To: schwab at suse dot de
- Cc: binutils at sources dot redhat dot com
- Date: 30 Dec 2002 11:24:38 +0000
- Subject: Re: _bfd_dwarf2_find_nearest_line returns wrong filename
- References: <email@example.com>
> 2002-12-23 Andreas Schwab <firstname.lastname@example.org>
> * dwarf2.c (struct dwarf2_debug): Add relocs and reloc_count.
> (find_rela_addend): Take pointer to struct dwarf2_debug instead of
> section and symbols. Cache reloc section there. Don't check
> section in reloc, just compare offset.
> (read_indirect_string): Use find_rela_addend to relocate string
> (parse_comp_unit): Adjust call to find_rela_addend. Don't
> advance to next debug section until after
> comp_unit_find_nearest_line has been called.
Approved - please apply.
> + if (stash->reloc_count <= 0)
> + return 0;
As a minor optimisation, wouldn't it be better to move this test
outside of the "if (stash->relocs == NULL)" block, so that if
stash->reloc_count is zero, the "for (relc = 0; .." loop will not be
executed on a second or subsequent visit to the function ?
> - for (relc = 0; relc < reloc_count; relc++)
> - if (relocs[relc]->address == offset
> - && (*relocs[relc]->sym_ptr_ptr)->flags & BSF_SECTION_SYM
> - && strcmp ((*relocs[relc]->sym_ptr_ptr)->name,
> - ".debug_abbrev") == 0)
> + for (relc = 0; relc < stash->reloc_count; relc++)
> + if (stash->relocs[relc]->address == offset)
Also - is it safe to drop the test of the reloc's symbol pointer ?
Finally - would it be possible to develop a testcase to check the
patch's behaviour ?