有人能告诉我在 gdb 中使用进程记录/重放功能时执行日志将存储在哪里吗?
谢谢
拉吉
更新
#include <stdio.h>
int main (int argc, char const *argv[])
{
printf("Hello World\n");
printf("How are you?\n");
char *c = NULL;
printf("%c\n", *c);
return 0;
}
当我取消引用 时,上面的代码会出现段错误c .我想用这个例子来弄清楚如何使用 reverse-next/reverse-continue 在段错误后返回。我能够执行 reverse-next 并到达第一个 printf 语句,在记录执行时我在该语句处设置了一个断点。此后,当我在 gdb 中尝试“next”命令时,我看到光标在 printf 语句中移动,但在终端上看不到任何输出。总之,我想知道即使在出现段错误之后,是否可以使用记录/重放功能来查看执行历史记录?
最佳答案
我以为你必须手动指定
record save filename
默认文件名是 gdb_record.process_id,其中 process_id 是被调试进程的进程 ID。这意味着,如果您不指定它,请查看调试器的 CWD
更新
关于你关于 insn-number-max 的额外问题:
info record
Show various statistics about the state of process record and its in-memory execution log buffer, including:
- Whether in record mode or replay mode.
- Lowest recorded instruction number (counting from when the current execution log started recording instructions).
- Highest recorded instruction number.
- Current instruction about to be replayed (if in replay mode).
- Number of instructions contained in the execution log.
- Maximum number of instructions that may be contained in the execution log.
我不确定,但这可能表明整个内容毕竟保存在内存中。当然,64 位系统和大量交换(和 ulimit 无限制)将使此 “虚拟”限制
关于Gdb 进程记录/重放执行日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5515216/