[pal_loader] Introduce INSIDE_EMACS arg to pal_loader so it runs GDB under Emacs

This commit is contained in:
Isaku Yamahata
2019-08-05 12:22:27 -07:00
committed by Dmitrii Kuvaiskii
parent f53c3afd95
commit 161ea54354
2 changed files with 31 additions and 14 deletions
+3 -2
View File
@@ -3,7 +3,8 @@
DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
GDB_SCRIPT=$DIR/pal-gdb.py
GDB_SO=$DIR/sgx_gdb.so
set -x
if [ -z "$INSIDE_EMACS" ]; then
set -x
fi
LD_PRELOAD=$GDB_SO gdb -iex "set auto-load safe-path $GDB_SCRIPT" "$@"
+28 -12
View File
@@ -1,18 +1,31 @@
#!/usr/bin/env bash
if [ "$1" == "SGX" ]; then
if [ "$SGX" != "0" ]; then
export SGX=1
# Sometimes, we end up with a stray SGX_RUN in the environment,
# which makes the Makefile.Host unhappy
unset SGX_RUN
# The interaction of SGX and SGX_RUN is getting pretty unwieldly.
# We should kill off SGX_RUN. Here, we can get in trouble
# if the make invocation below gets SGX_RUN via an MAKEFLAGS
# from a wrapper makefile (e.g., the regression tests)
unset MAKEFLAGS
fi
while :
do
case "$1" in
"SGX")
SGX=1
;;
"GDB")
GDB=1
;;
*)
break
;;
esac
shift
done
if [ -n "$SGX" ] && [ "$SGX" != "0" ]; then
export SGX=1
# Sometimes, we end up with a stray SGX_RUN in the environment,
# which makes the Makefile.Host unhappy
unset SGX_RUN
# The interaction of SGX and SGX_RUN is getting pretty unwieldly.
# We should kill off SGX_RUN. Here, we can get in trouble
# if the make invocation below gets SGX_RUN via an MAKEFLAGS
# from a wrapper makefile (e.g., the regression tests)
unset MAKEFLAGS
fi
RUNTIME_DIR=$(/usr/bin/dirname $(readlink -f ${BASH_SOURCE[0]}))
@@ -30,6 +43,9 @@ if [ "$GDB" == "1" ]; then
fi
if [ "$GDB" != "" ] && [ "$GDB" != "0" ]; then
if [ -n "$INSIDE_EMACS" ]; then
GDB="$GDB -i=mi"
fi
PREFIX="$GDB --args"
fi