summaryrefslogtreecommitdiff
path: root/installed-tests/debugger-test.sh
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2018-07-12 16:48:51 +0200
committerPhilip Chimento <philip.chimento@gmail.com>2018-07-22 23:23:46 -0400
commitee89551eb8af59520252fc46e4cc6aac3b17af15 (patch)
tree5decf2f0c2a67c4ab611cad5984d37c25b23ad09 /installed-tests/debugger-test.sh
parent8ae00b8e68f512e665aa0fdb7fa7eea78274bc97 (diff)
downloadgjs-ee89551eb8af59520252fc46e4cc6aac3b17af15.tar.gz
debugger: GJS Debugger
This adds a simple debugger, adapted from the "jorendb" program in the SpiderMonkey source. It has basic stepping, breaking, and printing commands, that work like GDB. Activate it by running the GJS console interpreter with the -d or --debugger flag _before_ the name of the JS program on the command line. To integrate it into programs that embed the GJS interpreter, call gjs_context_setup_debugger_console() before executing the JS program. It will print when Promises are launched and resolved, although it's not yet possible to break at those points. Closes: #110
Diffstat (limited to 'installed-tests/debugger-test.sh')
-rwxr-xr-xinstalled-tests/debugger-test.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/installed-tests/debugger-test.sh b/installed-tests/debugger-test.sh
new file mode 100755
index 00000000..5052d8b8
--- /dev/null
+++ b/installed-tests/debugger-test.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then
+ gjs="$TOP_BUILDDIR/gjs-console"
+else
+ gjs=gjs-console
+fi
+
+echo 1..1
+
+DEBUGGER_SCRIPT="$1"
+JS_SCRIPT="$1.js"
+EXPECTED_OUTPUT="$1.output"
+THE_DIFF=$("$gjs" -d "$JS_SCRIPT" < "$DEBUGGER_SCRIPT" | sed \
+ -e "s#$1#$(basename $1)#g" \
+ -e "s/0x[0-9a-f]\{4,16\}/0xADDR/g" \
+ | diff -u "$EXPECTED_OUTPUT" -)
+if test -n "$THE_DIFF"; then
+ echo "not ok 1 - $1"
+ echo "$THE_DIFF" | while read line; do echo "#$line"; done
+else
+ echo "ok 1 - $1"
+fi