This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: gdb/1222: fails to find correct source file for a generated C file with #line directives
- From: Jim Blandy <jimb at redhat dot com>
- To: jimb at redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 21 May 2003 23:18:00 -0000
- Subject: Re: gdb/1222: fails to find correct source file for a generated C file with #line directives
- Reply-to: Jim Blandy <jimb at redhat dot com>
The following reply was made to PR symtab/1222; it has been noted by GNATS.
From: Jim Blandy <jimb@redhat.com>
To: fsblk@uaf.edu
Cc: gdb-gnats@sources.redhat.com
Subject: Re: gdb/1222: fails to find correct source file for a generated C file with #line directives
Date: 21 May 2003 18:18:18 -0500
Which debug format are you using? If you're using Dwarf 2, I think
this is a problem in GDB's Dwarf 2 reader.
You can tell by running the command 'readelf -S foo.o' on your object
files. You'll see entries like this:
[27] .debug_info PROGBITS 00000000 27433f 8978bf 00 0 0 1
[28] .debug_abbrev PROGBITS 00000000 b0bbfe 0353e4 00 0 0 1
If it contains Dwarf 2 info, and entries like this:
[23] .stab PROGBITS 00000000 0004a4 000024 0c 24 0 4
[24] .stabstr STRTAB 00000000 0004c8 000036 00 0 0 1
if it contains STABS.
The problem is that the Dwarf 2 reader doesn't construct partial
symbol tables for anything but the main .c file; files referred to via
#line directives or #includes don't get recorded at all. Of course,
if you do anything that causes GDB to read the full symbols for that
.c file, at that point you'll get symtabs for all the source files ---
including ones mentioned via #line.
The solution would be for the Dwarf 2 reader to go look at the source
location info of each DW_TAG_compile_unit die, and build psymtabs for
all the filenames it finds there.