Quellcode durchsuchen

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

Isaku Yamahata vor 4 Jahren
Ursprung
Commit
161ea54354
2 geänderte Dateien mit 31 neuen und 14 gelöschten Zeilen
  1. 3 2
      Pal/src/host/Linux-SGX/debugger/gdb
  2. 28 12
      Runtime/pal_loader

+ 3 - 2
Pal/src/host/Linux-SGX/debugger/gdb

@@ -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
Runtime/pal_loader

@@ -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