gdb reverse stepping - not supported in Linux?

gcc, gdb, linux

Solution

I'm no expert, but it appears that maybe you forgot to enable gdb recording.

(gdb) record
(gdb) continue
(gdb) reverse-continue
Continuing.

For example, this worked for me

Breakpoint 1, main (argc=1, argv=0x7ffe673b5638) at ...
7     int lol = 0xbeefface;
(gdb) record
(gdb) continue
Continuing.

Program stopped.
0x00007f710c188746 in __GI__exit ...
(gdb) reverse-continue
Continuing.
...
No more reverse-execution history.
main (argc=1, argv=0x7ffe673b5638) at ...
7     int lol = 0xbeefface;

I was able to reproduce your issue with

Breakpoint 1, main (argc=1, argv=0x7ffeb7945198) at main.c:7
7     int lol = 0xbeefface;
(gdb) b _exit
Breakpoint 2 at 0x7fc62dbb8710: file ...
(gdb) continue
Continuing.

Breakpoint 2, __GI__exit ...
(gdb) reverse-continue
Target native does not support this command.

Problem

``` (gdb) reverse-step Target child does not support this command. ``` This is in Linux 2.6.18 Does the kernel not support it? Is there a special gcc arg I need? ``` gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52) ```

Original source