Last active
December 2, 2020 15:58
-
-
Save sumerc/8d6bbc40cc67dae1bf4f6193a71cfc3b to your computer and use it in GitHub Desktop.
Run GDB repeatedly and get a backtrace when error happens
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 | |
set -eu | |
i=1 | |
while [ $i -le 10 ] | |
do | |
gdb_output=$(gdb -batch -ex "run" -ex "bt" --args python regression.py 2>&1) | |
if [[ ${gdb_output} != *'No stack'* ]]; then | |
echo -e "${gdb_output}" | |
break | |
fi | |
echo "Running $i" | |
i=$(( $i + 1 )) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment