[Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
ppluzhnikov at google dot com
gcc-bugzilla@gcc.gnu.org
Sat Jun 27 00:49:00 GMT 2009
------- Comment #12 from ppluzhnikov at google dot com 2009-06-27 00:49 -------
This appears to still be broken in 32-bit mode.
I just built GCC @148996 on x86_64, and compiled the attached test case with
'-m32':
(gdb) start
Breakpoint 1 at 0x80483d9: file gcc-pr40012-test.c, line 24.
main () at gcc-pr40012-test.c:24
24 list a3 = { 0 };
(gdb) n
25 f0(0, 0, 0, &a3);
(gdb) p &a3
$1 = (list *) 0xffffccb4
(gdb) s
f0 (a=0x0, b=0x0, c=0x0, d=0xffffcc8c) at gcc-pr40012-test.c:15
15 for(problem = d; problem; problem = problem->next) {
Clearly GDB and GCC are in disagreement about the location of a3.
Disassebly shows:
0x080483d0 <main+0>: push %ebp
0x080483d1 <main+1>: mov %esp,%ebp
0x080483d3 <main+3>: and $0xfffffff0,%esp
0x080483d6 <main+6>: sub $0x20,%esp
0x080483d9 <main+9>: movl $0x0,0x1c(%esp)
0x080483e1 <main+17>: lea 0x1c(%esp),%eax
0x080483e5 <main+21>: mov %eax,0xc(%esp)
0x080483e9 <main+25>: movl $0x0,0x8(%esp)
0x080483f1 <main+33>: movl $0x0,0x4(%esp)
0x080483f9 <main+41>: movl $0x0,(%esp)
0x08048400 <main+48>: call 0x8048394 <f0>
0x08048405 <main+53>: mov $0x0,%eax
0x0804840a <main+58>: leave
0x0804840b <main+59>: ret
readelf -w:
<1><1ee>: Abbrev Number: 12 (DW_TAG_subprogram)
<1ef> DW_AT_external : 1
<1f0> DW_AT_name : (indirect string, offset: 0xf5): main
<1f4> DW_AT_decl_file : 1
<1f5> DW_AT_decl_line : 22
<1f6> DW_AT_type : <0x1df>
<1fa> DW_AT_low_pc : 0x80483d0
<1fe> DW_AT_high_pc : 0x804840c
<202> DW_AT_frame_base : 0x38 (location list)
<206> DW_AT_sibling : <0x218>
<2><20a>: Abbrev Number: 13 (DW_TAG_variable)
<20b> DW_AT_name : a3
<20e> DW_AT_decl_file : 1
<20f> DW_AT_decl_line : 24
<210> DW_AT_type : <0x161>
<214> DW_AT_location : 2 byte block: 91 14 (DW_OP_fbreg: 20)
And
00000038 080483d0 080483d1 (DW_OP_breg4: 4)
00000038 080483d1 080483d3 (DW_OP_breg4: 8)
00000038 080483d3 0804840b (DW_OP_breg5: 8)
00000038 0804840b 0804840c (DW_OP_breg4: 4)
00000038 <End of list>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
More information about the Gcc-bugs
mailing list