Skip to content

Instantly share code, notes, and snippets.

@tomrittervg
Created March 2, 2022 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomrittervg/f9002b54146e1fca8f1a0102f85a0dd4 to your computer and use it in GitHub Desktop.
Save tomrittervg/f9002b54146e1fca8f1a0102f85a0dd4 to your computer and use it in GitHub Desktop.
#!/bin/bash
CMD_FILE=$(date +"%s")
grep [r-][w-][x-][ps] /proc/$1/maps \
| sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' \
| while read start stop; do \
echo "dump memory $1-$start-$stop.dump 0x$start 0x$stop" >> $CMD_FILE; \
done
gdb --batch --pid $1 -x $CMD_FILE
rm $CMD_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment