[Bug debug/84550] [8 Regression] stepping through gcc does not work with gdb 8.0.1
palves at redhat dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 28 16:40:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84550
--- Comment #6 from Pedro Alves <palves at redhat dot com> ---
I see the same thing with your reduced testcase:
~~~
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x400580
infrun: stepped into subroutine
infrun: inserting step-resume breakpoint at 0x400410
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread
[process 13966] at 0x400580
~~~
0x400410 is never hit.
With:
(gdb) disassemble /s qux
Dump of assembler code for function qux(C*):
t.c:
33 if (!p->c) __builtin_abort ();
0x0000000000400410 <+0>: callq 0x400400 <abort@plt>
0x0000000000400415: nopw %cs:0x0(%rax,%rax,1)
0x000000000040041f: nop
...
0x0000000000400578 <+16>: nopl 0x0(%rax,%rax,1)
9 return false;
0x0000000000400580 <+0>: xor %eax,%eax
0x0000000000400582 <+2>: retq
0x0000000000400583: nopl (%rax)
0x0000000000400586: nopw %cs:0x0(%rax,%rax,1)
---Type <return> to continue, or q <return> to quit---
... we see that "foo" is sharing the tail end of qux?
And we see that "0x400410", where GDB things foo's prologue ends,
is actually the end of qux's prologue:
(gdb) disassemble /s foo
Dump of assembler code for function qux(C*):
t.c:
33 if (!p->c) __builtin_abort ();
0x0000000000400410 <+0>: callq 0x400400 <abort@plt>
0x0000000000400415: nopw %cs:0x0(%rax,%rax,1)
0x000000000040041f: nop
When we do "b foo", gdb sets a breakpoint at 0x400580 instead (passed foo's
prologue). I don't know why it gets it wrong when stepping into the function.
More information about the Gcc-bugs
mailing list