Home > Back-end >  enable core dump logging with bash script
enable core dump logging with bash script

Time:09-26

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?

CodePudding user response:

Try something like this:

#!/bin/bash
[ -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).

  • Related