Is it possible to dump the current memory allocated for a process (by PID) to a file? Or read it somehow?
|
I'm not sure how you dump all the memory to a file without doing this repeatedly (if anyone knows an automated way to get gdb to do this please let me know), but the following works for any one batch of memory assuming you know the pid:
Pick one batch of memory (so for example 00621000-00622000) then use gdb to attach to the process and dump that memory: |
|||
|
|
|
I've made a script that accomplishes this task. The idea commes from James Lawrie's answer and this post: http://www.linuxforums.org/forum/programming-scripting/52375-reading-memory-other-processes.html#post287195
put this in a file (eg. "dump-all-memory-of-pid.sh") and make it executable usage: The output is printed to files with the names: Dependencies: |
|||
|
|
|
man proc says :
Maybe it can help you |
|||
|
|
try
where pid is the actual number of the pid; for more info see: info gcore may take some time for the dump happens, and some memory may not be readable, but is good enough... be aware also that it can create big files, I just created a 2GB file that way.. |
|||
|
|
|
Tool to dump process to standard output, pcat/memdump: |
||||
|