Support for --gdb for target run-test.
Add a --gdb option for target run-test that starts the test with
gdbserver. So that this is clear it forces the test to be run in dev
mode too.
Change-Id: I539e30d49b6e0beea38c6e9c60abb16e3f4062f7
diff --git a/test/etc/host-run-test-jar b/test/etc/host-run-test-jar
index 5c9d9ed..7e76c17 100755
--- a/test/etc/host-run-test-jar
+++ b/test/etc/host-run-test-jar
@@ -2,13 +2,6 @@
#
# Run the code in test.jar using the host-mode virtual machine. The jar should
# contain a top-level class named Main to run.
-#
-# Options:
-# --quiet -- don't chatter
-# --debug -- wait for debugger to attach
-# --interpreter -- enable interpreter only mode (off by default)
-# --no-verify -- turn off verification (on by default)
-# --no-optimize -- turn off optimization (on by default)
msg() {
if [ "$QUIET" = "n" ]; then
diff --git a/test/etc/push-and-run-test-jar b/test/etc/push-and-run-test-jar
index 7154ac2..ce80ae4 100755
--- a/test/etc/push-and-run-test-jar
+++ b/test/etc/push-and-run-test-jar
@@ -2,17 +2,6 @@
#
# Run the code in test.jar on the device. The jar should contain a top-level
# class named Main to run.
-#
-# Options:
-# --quiet -- don't chatter
-# --debug -- wait for debugger to attach
-# --zygote -- use the zygote (if so, all other options are ignored)
-# --dev -- development mode (print the vm invocation cmdline)
-# --interpreter -- enable interpreter only mode (off by default)
-# --no-verify -- turn off verification (on by default)
-# --no-optimize -- turn off optimization (on by default)
-# --no-precise -- turn off precise GC (on by default)
-# -O -- run non-debug code
msg() {
if [ "$QUIET" = "n" ]; then
@@ -21,6 +10,7 @@
}
OATEXEC="oatexecd"
+GDB="n"
DEBUG="n"
INTERPRETER="n"
VERIFY="y"
@@ -40,6 +30,10 @@
elif [ "x$1" = "x--debug" ]; then
DEBUG="y"
shift
+ elif [ "x$1" = "x--gdb" ]; then
+ GDB="y"
+ DEV_MODE="y"
+ shift
elif [ "x$1" = "x--zygote" ]; then
ZYGOTE="--zygote"
msg "Spawning from zygote"
@@ -119,6 +113,11 @@
DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
fi
+if [ "$GDB" = "y" ]; then
+ gdb="gdbserver :5039"
+ gdbargs="--args $exe"
+fi
+
if [ "$INTERPRETER" = "y" ]; then
INT_OPTS="-Xint"
fi
@@ -126,7 +125,7 @@
JNI_OPTS="-Xjnigreflimit:512 -Xcheck:jni"
cmdline="cd $DEX_LOCATION && mkdir art-cache && export ANDROID_DATA=$DEX_LOCATION && export DEX_LOCATION=$DEX_LOCATION && \
- $INVOKE_WITH $OATEXEC $ZYGOTE $JNI_OPTS $INT_OPTS $DEBUG_OPTS -Ximage:/data/art-test/core.art -cp $DEX_LOCATION/$TEST_NAME.jar Main"
+ $INVOKE_WITH $gdb $OATEXEC $gdbargs $ZYGOTE $JNI_OPTS $INT_OPTS $DEBUG_OPTS -Ximage:/data/art-test/core.art -cp $DEX_LOCATION/$TEST_NAME.jar Main"
if [ "$DEV_MODE" = "y" ]; then
echo $cmdline "$@"
fi
diff --git a/test/run-test b/test/run-test
index 739b589..46d966c 100755
--- a/test/run-test
+++ b/test/run-test
@@ -168,7 +168,7 @@
echo " Runtime Options:"
echo " -O Run oatexec rather than oatexecd (off by default)."
echo " --debug Wait for a debugger to attach."
- #echo " --gdb Run under gdb; incompatible with some tests."
+ echo " --gdb Run under gdb; incompatible with some tests."
echo " --build-only Build test files only (off by default)."
echo " --interpreter Enable interpreter only mode (off by default)."
echo " --no-verify Turn off verification (on by default)."