Skip to content

Instantly share code, notes, and snippets.

@toomore
Created February 11, 2015 02:20
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 toomore/0f4c7bb2fa6e17fb0b0f to your computer and use it in GitHub Desktop.
Save toomore/0f4c7bb2fa6e17fb0b0f to your computer and use it in GitHub Desktop.
gdb from the process's memory mappings
# Set pid of nginx master process here
pid=4629
# generate gdb commands from the process's memory mappings using awk
cat /proc/$pid/maps | awk '$6 !~ "^/" {split ($1,addrs,"-"); print "dump memory mem_" addrs[1] " 0x" addrs[1] " 0x" addrs[2] ;}END{print "quit"}' > gdb-commands
# use gdb with the -x option to dump these memory regions to mem_* files
gdb -p $pid -x gdb-commands
# look for some (any) nginx.conf text
grep worker_connections mem_*
grep server_name mem_*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment