summaryrefslogtreecommitdiff
path: root/openjdkjvmti/ti_extension.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2019-05-17 21:44:36 +0000
committer Alex Light <allight@google.com> 2019-05-20 16:13:34 +0000
commit639e73b5ad1d96a1e67743735a13f7a268b455aa (patch)
treed362fd58d8e1ab68a512f3f0f33b0fe1384e0a26 /openjdkjvmti/ti_extension.cc
parentf03b151a9b86bc47f501ec7ea0b71d0598e90d52 (diff)
Revert^2 "Add AddToDexClassloader JVMTI extension functions"
This reverts commit 799e536da9733ab638946f56e1ceb62d62cd3c81. It seems that on some of our test devices the kernel does not have an implementation for memfd_create. To work around this I added a basic wrapper that will simulate memfd_create using temp files. This should be sufficient for testing. All actual devices are expected to support the memfd_create syscall natively. Reason for revert: Implemented fallback for memfd_create Bug: 132699522 Bug: 132914283 Test: ./test.py --host Change-Id: I63b36464df24193fff27624c1e2350d65545ad1d
Diffstat (limited to 'openjdkjvmti/ti_extension.cc')
-rw-r--r--openjdkjvmti/ti_extension.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/openjdkjvmti/ti_extension.cc b/openjdkjvmti/ti_extension.cc
index f12cb0a380..a21a97f5d0 100644
--- a/openjdkjvmti/ti_extension.cc
+++ b/openjdkjvmti/ti_extension.cc
@@ -42,6 +42,7 @@
#include "ti_heap.h"
#include "ti_logging.h"
#include "ti_monitor.h"
+#include "ti_search.h"
#include "thread-inl.h"
@@ -327,6 +328,48 @@ jvmtiError ExtensionUtil::GetExtensionFunctions(jvmtiEnv* env,
return error;
}
+ // AddToDexClassLoader
+ error = add_extension(
+ reinterpret_cast<jvmtiExtensionFunction>(SearchUtil::AddToDexClassLoader),
+ "com.android.art.classloader.add_to_dex_class_loader",
+ "Adds a dexfile to a given dalvik.system.BaseDexClassLoader in a manner similar to"
+ " AddToSystemClassLoader.",
+ {
+ { "classloader", JVMTI_KIND_IN, JVMTI_TYPE_JOBJECT, false },
+ { "segment", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, false },
+ },
+ {
+ ERR(NULL_POINTER),
+ ERR(CLASS_LOADER_UNSUPPORTED),
+ ERR(ILLEGAL_ARGUMENT),
+ ERR(WRONG_PHASE),
+ });
+ if (error != ERR(NONE)) {
+ return error;
+ }
+
+ // AddToDexClassLoaderInMemory
+ error = add_extension(
+ reinterpret_cast<jvmtiExtensionFunction>(SearchUtil::AddToDexClassLoaderInMemory),
+ "com.android.art.classloader.add_to_dex_class_loader_in_memory",
+ "Adds a dexfile buffer to a given dalvik.system.BaseDexClassLoader in a manner similar to"
+ " AddToSystemClassLoader. This may only be done during the LIVE phase. The buffer is copied"
+ " and the caller is responsible for deallocating it after this call.",
+ {
+ { "classloader", JVMTI_KIND_IN, JVMTI_TYPE_JOBJECT, false },
+ { "dex_bytes", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, false },
+ { "dex_bytes_len", JVMTI_KIND_IN, JVMTI_TYPE_JINT, false },
+ },
+ {
+ ERR(NULL_POINTER),
+ ERR(CLASS_LOADER_UNSUPPORTED),
+ ERR(ILLEGAL_ARGUMENT),
+ ERR(WRONG_PHASE),
+ });
+ if (error != ERR(NONE)) {
+ return error;
+ }
+
// Copy into output buffer.
*extension_count_ptr = ext_vector.size();