xt-sim: add support for 'make debug'

Change-Id: I60b64c6b8c83e1e1c49d8cb2c5f857faee88a7a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/boards/xtensa/xt-sim/Makefile.board b/boards/xtensa/xt-sim/Makefile.board
index 9e779b0..4058f2d 100644
--- a/boards/xtensa/xt-sim/Makefile.board
+++ b/boards/xtensa/xt-sim/Makefile.board
@@ -1,3 +1,4 @@
 # Default to xt-run but let the user override to xtsc-run if they desire
 EMU_PLATFORM ?= xt-run
+DEBUG_SCRIPT := xt-gdb.sh
 
diff --git a/scripts/support/xt-gdb.sh b/scripts/support/xt-gdb.sh
new file mode 100644
index 0000000..ab78eb1
--- /dev/null
+++ b/scripts/support/xt-gdb.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+XT_GDB=$XTENSA_TOOLS_PATH/bin/xt-gdb
+ELF_NAME=${O}/${KERNEL_ELF_NAME}
+
+set -e
+
+do_debug() {
+    ${XT_GDB} ${ELF_NAME}
+}
+
+CMD="$1"
+shift
+
+case "${CMD}" in
+  debug)
+    do_debug "$@"
+    ;;
+  *)
+    echo "${CMD} not supported"
+    exit 1
+    ;;
+esac