Add property-changing JVMTI agent wrapper.
Adds libwrapagentproperties agent that allows one to change or add to
the system properties observed by a JVMTI agent. This is useful for
compatibility as some JVMTI agents expect to be able to find system
properties that are not present in ART. With this we can run them
without having to modify the runtime itself.
Also adds a --agent-wrapper flag to run-jdwp-tests.sh to facilitate
the use of this agent.
Test: mma -j40 libwrapagentproperties
Test: ./art/tools/run-jdwp-tests.sh \
--mode=host \
--variant=x64 \
-Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmtid.so \
--jdwp-path /usr/lib/jvm/default-java/jre/lib/amd64/libjdwp.so \
--agent-wrapper $ANDROID_HOST_OUT/lib64/libwrapagentproperties.so=$PWD/art/tools/libjdwp-compat.props
Change-Id: Ic5eef7e9b4b8c54f4b0683dbb4e71768cbf4f97c
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index 2e59af9..d0e35ac 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -45,6 +45,8 @@
debug="no"
verbose="no"
image="-Ximage:/data/art-test/core.art"
+with_jdwp_path=""
+agent_wrapper=""
vm_args=""
# By default, we run the whole JDWP test suite.
test="org.apache.harmony.jpda.tests.share.AllTests"
@@ -89,6 +91,14 @@
# We don't care about jit with the RI
use_jit=false
shift
+ elif [[ $1 == --agent-wrapper ]]; then
+ # Remove the --agent-wrapper from the arguments.
+ args=${args/$1}
+ shift
+ agent_wrapper=${agent_wrapper}${1},
+ # Remove the argument
+ args=${args/$1}
+ shift
elif [[ $1 == -Ximage:* ]]; then
image="$1"
shift
@@ -119,8 +129,7 @@
# Remove the --jdwp-path from the arguments.
args=${args/$1}
shift
- vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentArgument=\"-agentpath:\""
- vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentName=$1"
+ with_jdwp_path=$1
# Remove the path from the arguments.
args=${args/$1}
shift
@@ -140,6 +149,10 @@
if [[ $mode == "ri" ]]; then
using_jack="false"
+ if [[ "x$with_jdwp_path" != "x" ]]; then
+ vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentArgument=-agentpath:${agent_wrapper}"
+ vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentName=$with_jdwp_path"
+ fi
if [[ "x$image" != "x" ]]; then
echo "Cannot use -Ximage: with --mode=jvm"
exit 1
@@ -148,6 +161,10 @@
exit 1
fi
else
+ if [[ "x$with_jdwp_path" != "x" ]]; then
+ vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentArgument=-agentpath:${agent_wrapper}"
+ vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentName=${with_jdwp_path}"
+ fi
vm_args="$vm_args --vm-arg -Xcompiler-option --vm-arg --debuggable"
# Make sure the debuggee doesn't clean up what the debugger has generated.
art_debugee="$art_debugee --no-clean"