Saving and restarting a suspended gdb session

I understand that gdb can control the full state of a running program. Can I save a gdb session that is paused at a breakpoint and resume the session later?

My first attempt was to simply dump the kernel in the first gdb session that was paused at the breakpoint, and then using a kernel dump to start the second gdb session.

Saving kernel file in gdb

This led to the following error.

Program terminated with signal SIGTRAP, Trace/breakpoint trap.

Thus, information about the control point is inserted into the state of the program, interesting. In the second attempt, I did the same, but this time I added the same breakpoint in the second session as in the first session.

Getting gdb to save a list of breakpoints?

However, I get the same error.

Is it possible to save and restart a gdb session? If so, how?

I do not think this is directly related, but I also get this warning.

warning: core file may not match specified executable file.

Is gdb merely a statement that such a thing is even possible, or does gdb believe that this could happen in the current session? I am sure that the same executable that created the kernel dump runs under gdb.

Edit: for someone else who comes along, this question is: Save process memory for later use? adds the answer by Matz Petersson and links to this article: http://blogs.msdn.com/b/oldnewthing/archive/2004/04/20/116749.aspx , which is an interesting read. A related question also contains a proposal for wrapping a process in a virtual machine.

+4
1

, - . (, , , ), /, . , "". - , . "", . , , , . " ". , ...;)

+2

Source: https://habr.com/ru/post/1546253/


All Articles