This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Re: Section .debug_info in object file
Hi Richard,
On Thu, Sep 12, 2002 at 01:54:34PM -0700, Richard Henderson wrote:
> On Thu, Sep 12, 2002 at 10:03:03PM +0300, Elias Athanasopoulos wrote:
> > * dwarf2dbg.c (out_debug_abbrev): Add support for the DW_AT_name field.
> > (out_debug_info): Likewise.
>
> I suppose we could do something like this.
>
> But it seems to me that this is a gdb bug. The complete file+line
> mapping is available in .debug_line. What purpose does the AT_name
> field of the compilation unit serve?
After some short investigation I concluded that gdb stores in the
symtable along with the file name (which is taken from DW_AT_name) the
lowpc field (DW_AT_low_pc). This happens inside dwarf2_build_psymtabs_hard():
/* Allocate a new partial symbol table structure */
pst = start_psymtab_common (objfile, objfile->section_offsets,
comp_unit_die.name ? comp_unit_die.name : "",
comp_unit_die.lowpc,
objfile->global_psymbols.next,
objfile->static_psymbols.next);
I guess this information can be taken also from .debug_line. Do we want
to build the symtable using .debug_line instead of .debug_info?
Also, about my previous patch, gcc includes the DW_AT_name field in
.debug_abbrev, but gas does not. So, readelf expects to find a DW_AT_name
field in .debug_info section, which is created by gas. I believe that gas
should export the DW_AT_name in the .debug_info section, otherwise utilities
such as readelf will have problems parsing the debug information correctly.
Elias
--
http://gnewtellium.sourceforge.net MP3 is not a crime.