summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/stack_map.h16
-rwxr-xr-xtest/901-hello-ti-agent/run10
-rwxr-xr-xtest/902-hello-transformation/run26
-rwxr-xr-xtest/903-hello-tagging/run26
-rwxr-xr-xtest/904-object-allocation/run26
-rwxr-xr-xtest/905-object-free/run26
-rwxr-xr-xtest/906-iterate-heap/run26
-rwxr-xr-xtest/907-get-loaded-classes/run26
-rwxr-xr-xtest/908-gc-start-finish/run26
-rwxr-xr-xtest/910-methods/run26
-rwxr-xr-xtest/911-get-stack-trace/run26
-rwxr-xr-xtest/912-classes/run26
-rwxr-xr-xtest/913-heaps/run26
-rwxr-xr-xtest/914-hello-obsolescence/run27
-rwxr-xr-xtest/915-obsolete-2/run27
-rwxr-xr-xtest/916-obsolete-jit/run26
-rwxr-xr-xtest/917-fields-transformation/run26
-rwxr-xr-xtest/etc/run-test-jar29
18 files changed, 61 insertions, 386 deletions
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index dd7e53100f..5e556be286 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -1093,7 +1093,9 @@ class CodeInfo {
}
CodeInfoEncoding ExtractEncoding() const {
- return CodeInfoEncoding(region_.start());
+ CodeInfoEncoding encoding(region_.start());
+ AssertValidStackMap(encoding);
+ return encoding;
}
bool HasInlineInfo(const CodeInfoEncoding& encoding) const {
@@ -1254,6 +1256,18 @@ class CodeInfo {
uint16_t number_of_dex_registers,
bool dump_stack_maps) const;
+ // Check that the code info has valid stack map and abort if it does not.
+ void AssertValidStackMap(const CodeInfoEncoding& encoding) const {
+ if (region_.size() != 0 && region_.size() < GetStackMapsSize(encoding)) {
+ LOG(FATAL) << region_.size() << "\n"
+ << encoding.header_size << "\n"
+ << encoding.non_header_size << "\n"
+ << encoding.number_of_location_catalog_entries << "\n"
+ << encoding.number_of_stack_maps << "\n"
+ << encoding.stack_map_size_in_bytes;
+ }
+ }
+
private:
MemoryRegion GetStackMaps(const CodeInfoEncoding& encoding) const {
return region_.size() == 0
diff --git a/test/901-hello-ti-agent/run b/test/901-hello-ti-agent/run
index 8079a8c457..4379349cb2 100755
--- a/test/901-hello-ti-agent/run
+++ b/test/901-hello-ti-agent/run
@@ -14,14 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=901-hello-ti-agent \
- --android-runtime-option -Xplugin:${plugin}
+ --jvmti
diff --git a/test/902-hello-transformation/run b/test/902-hello-transformation/run
index 94a8b2d975..4379349cb2 100755
--- a/test/902-hello-transformation/run
+++ b/test/902-hello-transformation/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
- if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
- else
- other_args=""
- fi
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=902-hello-transformation,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- --android-runtime-option -Xfully-deoptable \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/903-hello-tagging/run b/test/903-hello-tagging/run
index 5e3c0bd32a..4379349cb2 100755
--- a/test/903-hello-tagging/run
+++ b/test/903-hello-tagging/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=903-hello-tagging,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/904-object-allocation/run b/test/904-object-allocation/run
index 2f7ad21886..4379349cb2 100755
--- a/test/904-object-allocation/run
+++ b/test/904-object-allocation/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=904-object-allocation,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/905-object-free/run b/test/905-object-free/run
index 753b742681..4379349cb2 100755
--- a/test/905-object-free/run
+++ b/test/905-object-free/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=905-object-free,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/906-iterate-heap/run b/test/906-iterate-heap/run
index 3e135a378d..4379349cb2 100755
--- a/test/906-iterate-heap/run
+++ b/test/906-iterate-heap/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=906-iterate-heap,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/907-get-loaded-classes/run b/test/907-get-loaded-classes/run
index 3f5a059fe2..4379349cb2 100755
--- a/test/907-get-loaded-classes/run
+++ b/test/907-get-loaded-classes/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=907-get-loaded-classes,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/908-gc-start-finish/run b/test/908-gc-start-finish/run
index 2fc35f0048..4379349cb2 100755
--- a/test/908-gc-start-finish/run
+++ b/test/908-gc-start-finish/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=908-gc-start-finish,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/910-methods/run b/test/910-methods/run
index 4dd2555f9e..4379349cb2 100755
--- a/test/910-methods/run
+++ b/test/910-methods/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=910-methods,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/911-get-stack-trace/run b/test/911-get-stack-trace/run
index 43fc325363..4379349cb2 100755
--- a/test/911-get-stack-trace/run
+++ b/test/911-get-stack-trace/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=911-get-stack-trace,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/912-classes/run b/test/912-classes/run
index 64bbb987a1..4379349cb2 100755
--- a/test/912-classes/run
+++ b/test/912-classes/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=912-classes,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/913-heaps/run b/test/913-heaps/run
index 7bd8cbd1dd..4379349cb2 100755
--- a/test/913-heaps/run
+++ b/test/913-heaps/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
-fi
-
-if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
-else
- other_args=""
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=913-heaps,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/914-hello-obsolescence/run b/test/914-hello-obsolescence/run
index b2f0b049a2..4379349cb2 100755
--- a/test/914-hello-obsolescence/run
+++ b/test/914-hello-obsolescence/run
@@ -14,31 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
- if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
- else
- other_args=""
- fi
-fi
-
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=914-hello-obsolescence,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- --android-runtime-option -Xfully-deoptable \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/915-obsolete-2/run b/test/915-obsolete-2/run
index bfe227fe2a..4379349cb2 100755
--- a/test/915-obsolete-2/run
+++ b/test/915-obsolete-2/run
@@ -14,31 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
- if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
- else
- other_args=""
- fi
-fi
-
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=915-obsolete-2,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- --android-runtime-option -Xfully-deoptable \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/916-obsolete-jit/run b/test/916-obsolete-jit/run
index 25c2c07470..9056211284 100755
--- a/test/916-obsolete-jit/run
+++ b/test/916-obsolete-jit/run
@@ -14,34 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
+# We are testing the redefinition of compiled code but with jvmti we only allow
+# jitted compiled code so always add the --jit argument.
if [[ "$@" == *"--jit"* ]]; then
other_args=""
else
other_args="--jit"
fi
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
- if [[ "$@" != *"--debuggable"* ]]; then
- other_args="$other_args -Xcompiler-option --debuggable "
- fi
-fi
-
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=915-obsolete-2,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- --android-runtime-option -Xfully-deoptable \
${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/917-fields-transformation/run b/test/917-fields-transformation/run
index a434b63e42..4379349cb2 100755
--- a/test/917-fields-transformation/run
+++ b/test/917-fields-transformation/run
@@ -14,30 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-plugin=libopenjdkjvmtid.so
-agent=libtiagentd.so
-lib=tiagentd
-if [[ "$@" == *"-O"* ]]; then
- agent=libtiagent.so
- plugin=libopenjdkjvmti.so
- lib=tiagent
-fi
-
-if [[ "$@" == *"--jvm"* ]]; then
- arg="jvm"
-else
- arg="art"
- if [[ "$@" != *"--debuggable"* ]]; then
- other_args=" -Xcompiler-option --debuggable "
- else
- other_args=""
- fi
-fi
-
./default-run "$@" --experimental agents \
--experimental runtime-plugins \
- --runtime-option -agentpath:${agent}=917-fields-transformation,${arg} \
- --android-runtime-option -Xplugin:${plugin} \
- --android-runtime-option -Xfully-deoptable \
- ${other_args} \
- --args ${lib}
+ --jvmti
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 566f7ba522..8245947251 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -30,6 +30,7 @@ HOST="n"
INTERPRETER="n"
JIT="n"
INVOKE_WITH=""
+IS_JVMTI_TEST="n"
ISA=x86
LIBRARY_DIRECTORY="lib"
TEST_DIRECTORY="nativetest"
@@ -59,14 +60,18 @@ ARGS=""
EXTERNAL_LOG_TAGS="n" # if y respect externally set ANDROID_LOG_TAGS.
DRY_RUN="n" # if y prepare to run the test but don't run it.
TEST_VDEX="n"
+TEST_IS_NDEBUG="n"
APP_IMAGE="y"
while true; do
if [ "x$1" = "x--quiet" ]; then
QUIET="y"
shift
+ elif [ "x$1" = "x--jvmti" ]; then
+ IS_JVMTI_TEST="y"
+ shift
elif [ "x$1" = "x-O" ]; then
- # Ignore this option.
+ TEST_IS_NDEBUG="y"
shift
elif [ "x$1" = "x--lib" ]; then
shift
@@ -382,6 +387,28 @@ if [ "$JIT" = "y" ]; then
fi
fi
+if [ "$IS_JVMTI_TEST" = "y" ]; then
+ plugin=libopenjdkjvmtid.so
+ agent=libtiagentd.so
+ lib=tiagentd
+ if [[ "$TEST_IS_NDEBUG" = "y" ]]; then
+ agent=libtiagent.so
+ plugin=libopenjdkjvmti.so
+ lib=tiagent
+ fi
+
+ ARGS="${ARGS} ${lib}"
+ if [[ "$USE_JVM" = "y" ]]; then
+ FLAGS="${FLAGS} -agentpath:${agent}=${TEST_NAME},jvm"
+ else
+ FLAGS="${FLAGS} -agentpath:${agent}=${TEST_NAME},art"
+ FLAGS="${FLAGS} -Xplugin:${plugin}"
+ FLAGS="${FLAGS} -Xfully-deoptable"
+ # Always make the compilation be debuggable.
+ COMPILE_FLAGS="${COMPILE_FLAGS} --debuggable"
+ fi
+fi
+
JNI_OPTS="-Xjnigreflimit:512 -Xcheck:jni"
if [ "$RELOCATE" = "y" ]; then