Add a way to pass GDB commands
Passing --gdb-arg to run-test sends the arg to GDB, example:
test/run-test --host --gdb --gdb-arg "--command=command.txt" 001-HelloWorld
Would run the test with the GDB script at command.txt on the host, this is
useful for running tests in GDB in a loop.
Bug: 17387969
Change-Id: I5ad455159a6d92783eacb17eecbb0f1e670cb4a3
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index d2cd8ab..5c0f83f 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -108,6 +108,11 @@
DEV_MODE="y"
TIME_OUT="n"
shift
+ elif [ "x$1" = "x--gdb-arg" ]; then
+ shift
+ gdb_arg="$1"
+ GDB_ARGS="${GDB_ARGS} $gdb_arg"
+ shift
elif [ "x$1" = "x--zygote" ]; then
ZYGOTE="-Xzygote"
msg "Spawning from zygote"
@@ -229,11 +234,11 @@
else
if [ `uname` = "Darwin" ]; then
GDB=lldb
- GDB_ARGS="-- $DALVIKVM"
+ GDB_ARGS="$GDB_ARGS -- $DALVIKVM"
DALVIKVM=
else
GDB=gdb
- GDB_ARGS="--args $DALVIKVM"
+ GDB_ARGS="$GDB_ARGS --args $DALVIKVM"
# Enable for Emacs "M-x gdb" support. TODO: allow extra gdb arguments on command line.
# gdbargs="--annotate=3 $gdbargs"
fi