gdb进程记录/回放执行日志 [英] Gdb process record/replay execution log
问题描述
有人能告诉我在gdb中使用进程记录/重放功能时,执行日志会存储在哪里吗?
谢谢拉杰
更新
#include <stdio.h>int main (int argc, char const *argv[]){printf("你好世界
");printf("你好吗?
");字符 *c = NULL;printf("%c
", *c);返回0;}
当我取消引用 c 时,上面的代码段错误.我想用这个例子来弄清楚如何使用 reverse-next/reverse-continue 在段错误后返回.我能够执行 reverse-next 并到达第一个 printf 语句,在该语句处我在记录执行时放置了一个断点.之后,当我在 gdb 中尝试下一个"命令时,我看到光标在 printf 语句中移动,但我没有看到终端上打印出任何输出.总之,我想知道即使在段错误之后,是否可以使用记录/重放功能来查看执行历史?
我以为你必须手动指定
记录保存文件名
默认文件名是gdb_record.process_id,其中process_id是被调试进程的进程ID.这意味着,如果您不指定它,请查看调试器的 CWD
更新
关于您对 insn-number-max 的额外问题:
信息记录
<块引用>
显示有关进程记录状态及其内存中的各种统计信息执行日志缓冲区,包括:
- 无论是录制模式还是回放模式.
- 最低记录指令数(从当前执行日志开始记录指令开始计数).
- 记录的最高指令编号.
- 即将重播的当前指令(如果处于重播模式).
- 执行日志中包含的指令数.
- 执行中可能包含的最大指令数记录.
我不确定,但这可能表明整个内容毕竟保存在内存中.当然,一个 64 位系统和大量的交换(和 ulimit 无限制)将使这成为虚拟"限制
Could somebody tell me where would the execution log be stored when using the process record/replay feature in gdb?
Thanks Raj
Update
#include <stdio.h>
int main (int argc, char const *argv[])
{
printf("Hello World
");
printf("How are you?
");
char *c = NULL;
printf("%c
", *c);
return 0;
}
The code above seg faults when I dereference c. I want to use this example to figure out how I can use reverse-next/reverse-continue to go back after a segfault. I am able to do reverse-next and reach the first printf statement at which I put a break point when recording the execution. After this, when I try the "next" command in gdb, I see that the cursor moves through the printf statements but I don't see any output printed on the terminal. In summary, I want to know if the record/replay feature can be used to go through the execution history even after a segfault?
I thought you had to manually specify that with
record save filename
The default filename is gdb_record.process_id, where process_id is the process ID of the debugged process. That means, if you don't specify it, look in the CWD of the debugger
Update
With respect to your extra question on 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.
I'm not to sure but this might indicate that the whole is kept in memory after all. Of course, a 64bit system and plenty of swap (and ulimit unlimited) will make this a 'virtual' limitation
这篇关于gdb进程记录/回放执行日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!