Created
May 14, 2014 09:07
-
-
Save mjf/ca064f8081c68005f314 to your computer and use it in GitHub Desktop.
dump_proc_mem - Dump (running) process memory using GDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
if [ $# -ne 1 ] | |
then | |
echo "Usage: ${0##*/} PID" 1>&2 | |
exit 1 | |
fi | |
cat /proc/$1/maps | | |
sed -n ' | |
s/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p | |
' | | |
while read START STOP | |
do | |
gdb --batch --pid $1 -ex "dump memory $1-$START-$STOP.dump 0x$START 0x$STOP" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment