enable core dump logging with bash script


There is a core dump file and I can use gdb to open and check the call stack. And I can export the content to gdb.txt by typing set logging on inside the gdb app. Now I’d like to use a script to realize it, bash or python whatever. Is it doable?


Try something like this:

[ -z "$1" ] && { echo executable required; exit 1; }
[ -z "$2" ] && { echo core required; exit 1; }
gdb --ex bt -ex quit "$1" "$2"

You can do set logging on if you want, or use the stdout from this script (possible filtered).

Answered By – Allan Wind

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published