GCC 4.1.0 doesn't generate DWARF 2 output for function arguments?
Nick Roberts
nickrob@snap.net.nz
Mon Apr 3 11:22:00 GMT 2006
I've just upgraded to Fedora Core 5 (kernel 2.6.15-1.2054_FC5) and with the
program below I get results which didn't occur before (Fedora Core 3). I
posted them to gdb@sources.redhat.com but I think something is up with GCC
4.1.0. I no longer have Core 3 so I've compared output with Mandrake. These
results are with DWARF 2. GCC 4.1.0 with stabs worked as expected
Nick http://www.inet.net.nz/~nickrob
/* -*- compile-command: "cc -g -o simple simple.c"; -*- */
main(int argc, char **argv) {
int i;
i = 1;
}
After starting execution and breaking at main:
With gcc --version
gcc (GCC) 3.2 (Mandrake Linux 9.0 3.2-1mdk)
(gdb) info args
argc = 1
argv = (char **) 0xbffff7a4
With gcc --version
gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)
(gdb) info args
No arguments.
readelf -wi simple (for GCC 3.2) gives (about 1200 lines of output):
...
<2><c6d>: Abbrev Number: 3 (DW_TAG_formal_parameter)
DW_AT_name : (indirect string, offset: 0x98e): argc
DW_AT_decl_file : 1
DW_AT_decl_line : 3
DW_AT_type : <c96>
DW_AT_location : 2 byte block: 91 8 (DW_OP_fbreg: 8; )
<2><c7b>: Abbrev Number: 3 (DW_TAG_formal_parameter)
DW_AT_name : (indirect string, offset: 0x993): argv
DW_AT_decl_file : 1
DW_AT_decl_line : 3
DW_AT_type : <c9d>
DW_AT_location : 2 byte block: 91 c (DW_OP_fbreg: 12; )
<2><c89>: Abbrev Number: 4 (DW_TAG_variable)
DW_AT_name : i
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_type : <c96>
DW_AT_location : 2 byte block: 91 7c (DW_OP_fbreg: -4; )
...
readelf -wi simple (for GCC 4.1.0) gives (about 60 lines of output):
...
<2><75>: Abbrev Number: 3 (DW_TAG_formal_parameter)
DW_AT_name : argc
DW_AT_decl_file : 1
DW_AT_decl_line : 3
DW_AT_type : <9a>
<2><81>: Abbrev Number: 3 (DW_TAG_formal_parameter)
DW_AT_name : argv
DW_AT_decl_file : 1
DW_AT_decl_line : 3
DW_AT_type : <a1>
<2><8d>: Abbrev Number: 4 (DW_TAG_variable)
DW_AT_name : i
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_type : <9a>
DW_AT_location : 2 byte block: 91 70 (DW_OP_fbreg: -16)
...
More information about the Gcc
mailing list