Gdb 进程记录/重放执行日志

标签 gdb record

有人能告诉我在 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/

相关文章:

android - 如何在 android 上使用 ffmpeg 录制视频?

arrays - 我可以指定数组不可分配给 Record 吗?

oracle - 使用具有多个 %rowtype 字段的 Oracle PL/SQL 记录表

java - 使用 JDBC 以用户定义的记录作为其 IN 参数调用 PL/SQL 过程

gdb - 查看以前的 gdb 命令

redirect - GDB 打印到文件而不是标准输出

scripting - 让 gdb 在中断或崩溃发生时运行命令

gdb - gdb 可以在每次中断时打印特定变量吗?

delphi - 类型转换无效 : convert record to tobject on 64-bit platform

gdb - 为什么我的 GDB 批处理模式退出状态总是 0?