Last active
September 17, 2015 05:43
-
-
Save mmasashi/0bb81f4e9269f7c5584d to your computer and use it in GitHub Desktop.
Get sigdump with timestamp filename and extract memory section in sorted order by the variable name.
This file contains 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/bash | |
pid=$(expr "$1" : '\([0-9][0-9]*\)') | |
if [ "$1" = "" ] || [ "$1" != "$pid" ]; then | |
echo "pid requires to be given" | |
exit 1 | |
fi | |
kill -CONT $pid | |
sleep 1 | |
DT_STR=$(date +"%Y%m%d_%H%M%S") | |
dump_fn="sigdump-${pid}.log.${DT_STR}" | |
mem_fn="memdump-${pid}.log.${DT_STR}" | |
mv "/tmp/sigdump-${pid}.log" "sigdump-${pid}.log.${DT_STR}" | |
line_num=$(cat $dump_fn| awk 'match($0, /All objects:/) {print NR}'|tail -n 1) | |
awk -v line_num=$line_num 'NR > line_num {print $2" "$1}' $dump_fn|sort > $mem_fn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment