This is the mail archive of the
binutils@sources.redhat.com
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: <m3smwoe46q.fsf@whitebox.local>
Hi Andreas,
> 2002-12-23 Andreas Schwab <schwab@suse.de>
>
> * 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
> offset.
> (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.
However ...
> + 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 ?
Cheers
Nick