summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2017-12-28 19:21:32 -0800
committerAndreas Gampe <agampe@google.com>2017-12-28 19:21:32 -0800
commit3b51a980d50338b854db7fcb27581972d14f35ef (patch)
tree9678e8c34cb5756e2fb84af2eebe39d4730cf12a
parent8dff75baaf60cbf15adf37385090f555f930043a (diff)
Libcore: Pass classloader for VMDebug.attachAgent
Pass an optional classloader as context for agent loading. Bug: 70901841 Test: m test-art-host Change-Id: I59ec55178792bc738fb06e0299522e207dd4a784
-rw-r--r--dalvik/src/main/java/dalvik/system/VMDebug.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/dalvik/src/main/java/dalvik/system/VMDebug.java b/dalvik/src/main/java/dalvik/system/VMDebug.java
index c1290ffef2..195c251311 100644
--- a/dalvik/src/main/java/dalvik/system/VMDebug.java
+++ b/dalvik/src/main/java/dalvik/system/VMDebug.java
@@ -512,5 +512,20 @@ public final class VMDebug {
*
* @param agent The path to the agent .so file plus optional agent arguments.
*/
- public static native void attachAgent(String agent) throws IOException;
+ public static void attachAgent(String agent) throws IOException {
+ attachAgent(agent, null);
+ }
+
+ /**
+ * Attaches an agent to the VM.
+ *
+ * @param agent The path to the agent .so file plus optional agent arguments.
+ * @param classLoader The classloader to use as a loading context.
+ */
+ public static void attachAgent(String agent, ClassLoader classLoader) throws IOException {
+ nativeAttachAgent(agent, classLoader);
+ }
+
+ private static native void nativeAttachAgent(String agent, ClassLoader classLoader)
+ throws IOException;
}