Hi,
is it a known bug that `main' function (and so even specially compiled with the
specific prologue/epilogue) missing DWARF `DW_AT_location' for its `argc' and
`argv' on 32-bit targets? I did not find a Bugzilla entry for it.
affected: x86_64-redhat-linux with -m32, i386-redhat-linux
not affected: x86_64-redhat-linux (-m64)
32-bit broken for: gcc-4.1.1, snapshot 4.2.0
always works: gcc-3.4.6
It causes gdb(1) to hide the arguments during backtrace:
#0 main () at test.c:3
Thanks,
Jan
correct (gcc-3.4.6):
<1><ee3>: Abbrev Number: 33 (DW_TAG_subprogram)
DW_AT_sibling : <f63>
DW_AT_external : 1
DW_AT_name : main
DW_AT_decl_file : 46
DW_AT_decl_line : 267
DW_AT_prototyped : 1
DW_AT_type : <c4>
DW_AT_low_pc : 0x8048c0f
DW_AT_high_pc : 0x8048e26
DW_AT_frame_base : 616 (location list)
<2><f02>: Abbrev Number: 34 (DW_TAG_formal_parameter)
DW_AT_name : argc
DW_AT_decl_file : 46
DW_AT_decl_line : 267
DW_AT_type : <c4>
DW_AT_location : 2 byte block: 91 0 (DW_OP_fbreg: 0)
<2><f12>: Abbrev Number: 34 (DW_TAG_formal_parameter)
DW_AT_name : argv
DW_AT_decl_file : 46
DW_AT_decl_line : 267
DW_AT_type : <f63>
DW_AT_location : 2 byte block: 91 4 (DW_OP_fbreg: 4)
incorrect (gcc-4.1.1):
<1><64>: Abbrev Number: 2 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : main
DW_AT_decl_file : 1
DW_AT_decl_line : 2
DW_AT_prototyped : 1
DW_AT_type : <9b>
DW_AT_low_pc : 0x8048324
DW_AT_high_pc : 0x804833d
DW_AT_frame_base : 0 (location list)
DW_AT_sibling : <9b>
<2><82>: Abbrev Number: 3 (DW_TAG_formal_parameter)
DW_AT_name : argc
DW_AT_decl_file : 1
DW_AT_decl_line : 1
DW_AT_type : <9b>
<2><8e>: Abbrev Number: 3 (DW_TAG_formal_parameter)
DW_AT_name : argv
DW_AT_decl_file : 1
DW_AT_decl_line : 1
DW_AT_type : <a2>