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:
where $pid is the actual number of the pid; for more info see: info gcore
may take some time for the dump to happen, 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..
If you want to dump a separate memory segment of the running process without creating huge core file (say with gcore), you can use a small tool from here.
There is also one-liner in README if you wish to dump all readable segments into separate files.
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:
./dump-all-memory-of-pid.sh [pid]
The output is printed to files with the names:
pid-startaddress-stopaddress.dump
Dependencies:
gdb
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:
This will be in the format (example):
Pick one batch of memory (so for example 00621000-00622000) then use gdb as root to attach to the process and dump that memory:
Then analyse /root/output with the strings command, less you want the PuTTY all over your screen.
try
where
$pid
is the actual number of the pid; for more info see:info gcore
may take some time for the dump to happen, 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..
Pure bash solution:
Usage: procdump PID
for a cleaner dump filter out
*.so
memory mapped shared libraries and empty memory ranges:man proc says :
Maybe it can help you
I made my own program to dump the entire process memory as well, it's in C so it can be cross-compiled to Android, which is what I needed.
You can also specify IP address and tcp port. Source code here.
Tool to dump process to standard output, pcat/memdump:
You can now use procdump from SysInternals suite on Linux:
https://github.com/Microsoft/ProcDump-for-Linux
If you want to dump a separate memory segment of the running process without creating huge core file (say with gcore), you can use a small tool from here. There is also one-liner in README if you wish to dump all readable segments into separate files.