[Bug debug/29628] New: [32bit] unused argc/argv missing their DW_AT_location
jan dot kratochvil at redhat dot com
gcc-bugzilla@gcc.gnu.org
Sat Oct 28 20:14:00 GMT 2006
`main' function (the function with specific prologue/epilogue) is missing DWARF
`DW_AT_location' for its `argc' and `argv' on 32-bit targets - only if these
arguments are never unused.
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, SVN snapshot 4.3.0
always works: gcc-3.4.6
It causes gdb(1) to hide the arguments during backtrace:
#0 main () at test.c:3
correct [i386]:
echo 'int main (int argc, char **argv) { return argc + (int) argv; }' >main.c
;gcc -o main.o main.c -ggdb3;readelf -a --debug main.o|grep -A5 -w argc
incorrect [i386]:
echo 'int main (int argc, char **argv) { return 0; }' >main.c ;gcc -o main.o
main.c -ggdb3;readelf -a --debug main.o|grep -A5 -w argc
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; appropriately for SVN snapshot - ~4.3.0):
<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>
dwarf2.out.c mem_loc_descriptor () GET_CODE (rtl):
`case REG:' for i386 `argc'; it will fail on:
if (REGNO (rtl) < FIRST_PSEUDO_REGISTER)
Checked there:
REGNO (rtl) == 61 /* Therefore pseudoreg. */
ORIGINAL_REGNO (rtl) == REGNO (rtl)
reg_renumber [61] == -1
On i386 with the arguments used it is fine as:
REGNO (rtl) == 1 /* Therefore hard register. */
On x86_64 it goes the `case PLUS:' way, not `case REG:'.
Could you advice where to find the location information for pseudoregisters
there?
--
Summary: [32bit] unused argc/argv missing their DW_AT_location
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jan dot kratochvil at redhat dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29628
More information about the Gcc-bugs
mailing list