dotfiles/.config/zsh/functions/gdb_get_backtrace

19 lines
350 B
Bash
Executable File

#!/usr/bin/env zsh
# Get backtrace from gdb
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
if [[ ${ARGC} -ne 2 ]]; then
print -u 2 "Usage: ${0} <executable> <core dump>"
return 1
fi
local exe="${1}"
local core="${2}"
gdb "${exe}" \
--core "${core}" \
--batch \
--quiet \
-ex "thread apply all bt full" \
-ex "quit"