diff options
| author | Andreas Gampe <agampe@google.com> | 2018-01-22 20:01:18 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2018-01-22 20:01:18 +0000 |
| commit | 03eb67c287e6b03c1ef5e0b63973de577b6c2002 (patch) | |
| tree | 382bb7470335dda652f161fc5a6f02f1066c6103 /core/java/android/os/Debug.java | |
| parent | 5b3e788908f664a18951a01df91e4147d02ef8a3 (diff) | |
| parent | 878abd8e9187c9f3cd1235b99deada092f72bddf (diff) | |
Merge "Debug: Add attachJvmtiAgent with classloader" am: 940c0341f0
am: 878abd8e91
Change-Id: I862a822ef7600030f7b435fe9b9368961cf4694b
Diffstat (limited to 'core/java/android/os/Debug.java')
| -rw-r--r-- | core/java/android/os/Debug.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index 2acf36fed85f..c3894c486936 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -1136,7 +1136,7 @@ public final class Debug int intervalUs) { VMDebug.startMethodTracing(fixTracePath(tracePath), bufferSize, 0, true, intervalUs); } - + /** * Formats name of trace log file for method tracing. */ @@ -2352,22 +2352,28 @@ public final class Debug } /** - * Attach a library as a jvmti agent to the current runtime. + * Attach a library as a jvmti agent to the current runtime, with the given classloader + * determining the library search path. + * <p> + * Note: agents may only be attached to debuggable apps. Otherwise, this function will + * throw a SecurityException. * - * @param library library containing the agent - * @param options options passed to the agent + * @param library the library containing the agent. + * @param options the options passed to the agent. + * @param classLoader the classloader determining the library search path. * - * @throws IOException If the agent could not be attached + * @throws IOException if the agent could not be attached. + * @throws SecurityException if the app is not debuggable. */ - public static void attachJvmtiAgent(@NonNull String library, @Nullable String options) - throws IOException { + public static void attachJvmtiAgent(@NonNull String library, @Nullable String options, + @Nullable ClassLoader classLoader) throws IOException { Preconditions.checkNotNull(library); Preconditions.checkArgument(!library.contains("=")); if (options == null) { - VMDebug.attachAgent(library); + VMDebug.attachAgent(library, classLoader); } else { - VMDebug.attachAgent(library + "=" + options); + VMDebug.attachAgent(library + "=" + options, classLoader); } } } |
