When developing on platforms with a different architecture and cross-compiling, it is often necessary to print the stack trace on a coredump.
TOOLCHAIN=/path/to/toolchain
DEBUGER=$TOOLCHAIN/gdb
EXECUTABLE=myprogram
CORE=coredumpfile
$DEBUGER -ex “set sysroot $TOOLCHAIN” -ex “set auto-load safe-path $TOOLCHAIN” -ex "file $EXECUTABLE" -ex "core-file CORE" -ex "thread apply all bt full" -ex "quit" > trace.log