"target record-full" 在 gdb 中使 "n" 命令在 printf 上失败 "Process record does not support instruction 0xc5 at address 0x7ffff7dee6e7"?

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

我想在 gdb 中使用 "reverse-step" 和 "reverse-next" 命令。堆栈溢出告诉我应该 运行 "target record-full" 在我希望 "rn" 和 "rs" 的执行上下文中。但是发生了一些奇怪的错误:

  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 } 

我编译并运行这个程序:

(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.

好吧,如果我不 运行 "target record-full",那么第二个 "n" 就可以了,运行 下一行。我不太明白这里的错误信息。

与"target record-full"有关吗?我怎样才能征服它?

我尝试了另一种方法:

(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

嗯,不行

实际上对于您遇到的简单情况,如果您将参数“-static”添加到您的 gcc 编译命令,record-full 应该可以工作。

自 GDB 7.11.1 起不支持 AVX

潜在的问题似乎是目前不支持 AVX 指令,但 glibc 在 Ubuntu 16.04 64 位上使用它们:

rr 是一个很棒的替代方案:https://github.com/mozilla/rr Here is a minimal working example: Setting breakpoint in GDB where the function returns