Message board for the users of flat assembler.
> Linux > Having a program save itself as an executable
nyrtzi 22 Nov 2007, 15:07
Lets say that there is an interactive program that modifies
itself and needs to offer the user the possibility to stop the
program and resume later.
I'm thinking that one solution could be that the program
could save itself as an executable file with the accumulated
modifications. This way if the user wanted to resume a previous
session he/she would just need to run the desired saved image.
The question is... what would the program need to write in the new file?
I'm asking this because I'm not sure if I remembered everything.
Probably the ELF header (so that the saved image can be executed...
after all this is Linux), the actual code of the program and the data
(all of the relevant stuff in the heap and elsewhere).
Am I forgetting anything (anything Linux specific for example)?
|22 Nov 2007, 15:07||
f0dder 22 Nov 2007, 17:33
Okay, on linux it *is* possible to dump your memory image to executable, unlike on Windows - but it's not really the best way to handle things...
You'd still need to reliably dump all memory structures you have allocated, and those most likely need pointer fixups etc... since you have to handle those, you might as well design a proper save/load routine and forget about simple image dumping
|22 Nov 2007, 17:33||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.