possible to revive a corefile back into a running program?
Asked Answered
A

2

6

I have a tool to generate snapshots of my C program as it's running, in the form of corefiles.

Is it possible to bring these corefiles back to life as executable programs? And if so, how do i do it? Are there any libraries that do this already?

I'm working on *nix systems.

Allemande answered 1/3, 2012 at 13:43 Comment(1)
I seem to recall that there was a Perl "compiler" that did something similar.Vermicide
K
2

Yes it is, in theory.

If your snapshot is a full dump of the whole memory of your program, the stack, the heap, along with the PC, it is possible to put this dump back in memory and launch the process of execution again. But you will have to do this in kernel land I think.

Kinser answered 1/3, 2012 at 13:58 Comment(0)
R
0

GDB will do that for you. I have used it for programs that have crashed, creating a core, but this should be no different, in theory.

Rios answered 1/3, 2012 at 16:30 Comment(2)
can you explain how to do it with gdb? i can explore a corefile with gdb (gdb executable_file core_file) but this is not the same as converting the corefile back into an executableAllemande
Oh... I think I misunderstood your end goal. So the goal is to allow people to 'resume' the executable in a similar manner to how it ran before? If so, I would probably take a different course of action and serialize the data that I cared about to a file and check for that file when my executable started.Rios

© 2022 - 2024 — McMap. All rights reserved.