Gdb process record/replay execution log

时间秒杀一切 提交于 2020-01-12 09:14:26

问题


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\n");
    printf("How are you?\n");
    char *c = NULL;
    printf("%c\n", *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?


回答1:


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



来源:https://stackoverflow.com/questions/5515216/gdb-process-record-replay-execution-log

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!