This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/12257] gdb ignore line "bar: if(foo)goto bar;"
- From: "tromey at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 07 Feb 2012 20:46:45 +0000
- Subject: [Bug gdb/12257] gdb ignore line "bar: if(foo)goto bar;"
- Auto-submitted: auto-generated
- References: <bug-12257-4717@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=12257
Tom Tromey <tromey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |tromey at redhat dot com
Resolution| |INVALID
--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2012-02-07 20:46:45 UTC ---
I think this is a gcc bug, not a gdb bug.
On Fedora 15,with the system gcc, it fails for me if I compile with -g.
But if I use -g -O1, it works
With plain -g, the line number table looks like:
CU: pr.c:
File name Line number Starting address
pr.c 4 0x400534
pr.c 6 0x40053c
pr.c 7 0x40054e
pr.c 8 0x400569
pr.c 8 0x40056a
pr.c 9 0x400571
pr.c 10 0x400576
Note the address of the first occurrence of line 8.
Then if I disassemble I see:
scanf("%d", &foo);
40054e: b8 84 06 40 00 mov $0x400684,%eax
400553: 48 8d 55 fc lea -0x4(%rbp),%rdx
400557: 48 89 d6 mov %rdx,%rsi
40055a: 48 89 c7 mov %rax,%rdi
40055d: b8 00 00 00 00 mov $0x0,%eax
400562: e8 d1 fe ff ff callq 400438 <__isoc99_scanf@plt>
400567: eb 01 jmp 40056a <main+0x36>
bar: if(foo)goto bar;
400569: 90 nop
40056a: 8b 45 fc mov -0x4(%rbp),%eax
40056d: 85 c0 test %eax,%eax
40056f: 75 f8 jne 400569 <main+0x35>
return 0;
That is, the first "line 8" is that nop, which is skipped after the call.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.