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 Cfile with #line directives
- From: Britton <fsblk at aurora dot uaf dot edu>
- To: jimb at redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 21 May 2003 23:58:00 -0000
- Subject: Re: gdb/1222: fails to find correct source file for a generated Cfile with #line directives
- Reply-to: Britton <fsblk at aurora dot uaf dot edu>
The following reply was made to PR symtab/1222; it has been noted by GNATS.
From: Britton <fsblk@aurora.uaf.edu>
To: Jim Blandy <jimb@redhat.com>
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: Wed, 21 May 2003 15:52:05 -0800 (AKDT)
It was DWARF-2, and compiling with -gstabs does indeed fix the problem,
thanks. It still looks like a thing very worth fixing since autoconf
and everything else tends to default to -g which apparently gives you
DWARF-2.
Britton Kerin
__
GNU GPL: "The Source will be with you... always."
On 21 May 2003, Jim Blandy wrote:
>
> 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.
>