30 lines
556 B
Bash
30 lines
556 B
Bash
|
#!/bin/zsh
|
||
|
# Various functions, to be sourced.
|
||
|
|
||
|
# Get backtrace from gdb.
|
||
|
function gdb_get_backtrace()
|
||
|
{
|
||
|
local exe=$1
|
||
|
local core=$2
|
||
|
|
||
|
gdb ${exe} \
|
||
|
--core ${core} \
|
||
|
--batch \
|
||
|
--quiet \
|
||
|
-ex "thread apply all bt full" \
|
||
|
-ex "quit"
|
||
|
}
|
||
|
|
||
|
# Export variable to Emacs.
|
||
|
function export-emacs
|
||
|
{
|
||
|
if [[ "$(emacsclient -e t)" != 't' ]]; then
|
||
|
return 1
|
||
|
fi
|
||
|
|
||
|
for name in "${@}"; do
|
||
|
value=$(eval echo \"\$${name}\")
|
||
|
emacsclient -e "(setenv \"${name}\" \"${value}\")" >/dev/null
|
||
|
done
|
||
|
}
|