Search code examples
cgdbreverse

"target record-full" in gdb makes "n" command fail on printf with "Process record does not support instruction 0xc5 at address 0x7ffff7dee6e7"?


I was tring to use "reverse-step" and "reverse-next" command inside gdb. Stack overflow tells me that I should run "target record-full" in the execution context where I wish to "rn" and "rs". But some weird error happened:

  1 
  2 #include<stdio.h>
  3 int i=0;
  4 void fa()
  5 { 
  6   ++i;
  7   printf("%d\n",i);
  8   ++i;
  9 }
 10 int main(){
 11   fa();
 12   return 0;
 13 } 

I compile and run this program:

(gdb) b 4
Breakpoint 1 at 0x40052a: file test02.c, line 4.
(gdb) r
Starting program: /home/Troskyvs/a.out 

Breakpoint 1, fa () at test02.c:6
6     ++i;
(gdb) target record-full
(gdb) n
7     printf("%d\n",i);
(gdb) n                      # Error happens here!
Process record does not support instruction 0xc5 at address 0x7ffff7dee6e7.
Process record: failed to record execution log.

Program stopped.
_dl_runtime_resolve_avx () at ../sysdeps/x86_64/dl-trampoline.h:81
81  ../sysdeps/x86_64/dl-trampoline.h: No such file or directory.

Well if I don't run "target record-full", then the 2nd "n" will be OK and run to next line. I don't quite get the error information here.

Is it related to "target record-full"? How can I conquor it?

I tried another approach:

(gdb) set exec-direction reverse
(gdb) n

No more reverse-execution history.
fa () at test02.c:7
7     printf("%d\n",i);
(gdb) n

No more reverse-execution history.
fa () at test02.c:7
7     printf("%d\n",i);
(gdb) n

Well, it doesn't work


Solution

  • AVX is not supported as of GDB 7.11.1

    The underlying problem seems to be that AVX instructions are not currently supported, but glibc uses them on Ubuntu 16.04 64-bit:

    rr is an awesome working alternative: https://github.com/mozilla/rr Here is a minimal working example: Setting breakpoint in GDB where the function returns