This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allow dwarf2 debug info for function at address 0


On Fri, Jul 21, 2006 at 04:23:13PM +0200, Frederic RISS wrote:
> The attached patch replaces the HAS_RELOC checks in dwarf2read.c with a
> per-objfile lookup for a section loaded at 0. With this modification,
> non-relocatable files that have a code at address 0 should be handled
> better (no discarded debug information). 
> As Daniel pointed out in the referenced thread, this solution isn't
> perfect because you can have valid code at 0 and at the same time
> 'orphaned' debug info that seemingly references the 0 address. However
> in the long run tools should correctly handle things like .gnu.linkonce,
> and with correct debug info this patch looks like the right thing. (BTW,
> was my testing defficient, or do recent GNU toolchains handle linkonce
> sections and associated debug info correctly?)

It can be pretty hard to trigger this sort of problem.  No, GNU
handling for linkonce debug info has not really changed in a while.

> 2006-07-21  Frederic Riss  <frederic.riss@st.com>
> 
> 	* dwarf2read.c (struct dwarf2_per_objfile): Add has_section_at_zero 
> 	field.
> 	(dwarf2_has_info): Initialize dwarf2_per_objfile->has_section_at_zero.
> 	(dwarf2_get_pc_bounds): Use dwarf2_per_objfile->has_section_at_zero 
> 	instead of HAS_RELOC test.
> 	(read_partial_die): Ditto.

This patch is OK.

One possible improvement; there's already a walk over all sections. 
You could set this flag directly in dwarf2_locate_sections, I think.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]