Created
April 29, 2019 16:36
-
-
Save covener/af161ffc16e8b01da956fb23cb1015d2 to your computer and use it in GitHub Desktop.
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/sh | |
# pstack workalike | |
if [ $# -lt 1 ]; then | |
echo "$0 pid [gdb args]" | |
echo "$0 core executable-path [gdb args]" | |
exit 1 | |
fi | |
PID_OR_CORE=$1 | |
if [ -f $PID_OR_CORE ]; then | |
EXE=$2 | |
shift | |
else | |
if [ ! -d /proc/$PID_OR_CORE ]; then | |
echo "First arg $1 does not look like a PID or core"; | |
exit 3 | |
fi | |
EXE=$(readlink /proc/$PID_OR_CORE/exe) | |
fi | |
shift | |
sudo gdb $EXE $PID_OR_CORE \ | |
# --init-eval-command "set auto-load safe-path /" \ | |
--eval-command "set height 0" \ | |
--eval-command "info threads" \ | |
--eval-command "info sharedlibrary" \ | |
--eval-command "thread apply all bt" \ | |
"$@" \ | |
--eval-command "detach" --eval-command "quit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment