Skip to content

Instantly share code, notes, and snippets.

@jmervine
Created November 6, 2012 20:33
Show Gist options
  • Save jmervine/4027330 to your computer and use it in GitHub Desktop.
Save jmervine/4027330 to your computer and use it in GitHub Desktop.
dump process memory to file
#!/bin/bash
if [ "$1" == "" ]; then
echo "proc id required"
exit 1
fi
grep rw-p /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