Core disaster recovery

The C ++ program crashed on FreeBSD 6.2, and the OS was kind enough to dump the kernel. Is it possible to amput several frames of the stack, reset the instruction pointer and restart the process in gdb and how?

+4
source share
3 answers

Is it possible to amputate some stack frames, reset the instruction pointer and restart the process in gdb?

I assume that you mean: change the state of the process and set it so that it starts again (as if it never crashed in the first place).

No. First, how do you suggest GDB (if this magic has this feature) will process your file descriptors (which the kernel automatically closes when your process dies)?

+3
source

Yes, gdb can debug basic dumps just like running programs. Assuming that a.out is the name of your program's executable and that a.core is the name of your main file, call gdb as follows:

 gdb a.out a.core 

And then you can debug, as usual, except that you cannot continue execution in any way (even if you could, the program would just work again). You can check stack trace, registers, memory, etc.

+2
source

Possible duplicate: Recommendations for recovery due to segmentation error

Summary: This is possible, but not recommended. The way to do this is usse setjmp () and longjmp () from the signal handler. (Please check out the full duplicate source code example.

0
source

All Articles