views:

26

answers:

1

hi all: recently i'm working on make checkpoint on linux process and encountered a problem,it looks like that when i munmap memory map of the executable to current process,the symlink /proc/self/exe is dead.what i want is to make this symlink pointing to a other executable(the one for my resumed processs),is that possible?i tried delete it and recreate, permission denied. english is not my native language, i hope i've made my point,thanx

+1  A: 

No. /proc is completely managed by the kernel and does not allow changes like that.

But you may be able to start a new process (with fork() perhaps) and map your memory snapshot into that.

Jonathan
thanks, in fact i just want to debug the resumed process with gdb. i make a snapshot in this way:first start loader,then fork() into two,then the parent process ptrace_stop the child ,unmap all its memory maps,and then map back saved memory data.everything work fine at first ,but when i use gdb attach,it says exe no such file or directory.the symlink was dead when memory map for the executable of child process was being erased.i think in order to debug the process,i have to make this exe thing pointing to the executable of resuming process.how can that be done,or is there any other ways?
zorroii
Ohhh, I see. You likely will not be able to adjust `exe`, but you might have better luck telling GDB to look elsewhere. Check the GDB user manual (http://sourceware.org/gdb/current/onlinedocs/gdb/), you may find an appropriate setting.
Jonathan
thank you very much, that helps a lot.hope gdb can tackle that problem directly
zorroii