diff options
| author | Andreas Gampe <agampe@google.com> | 2018-01-22 20:14:49 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2018-01-22 20:14:49 +0000 |
| commit | 627da5b264ffd4ae7edc0c578828bfdbee2766e9 (patch) | |
| tree | a065bb81657355cf4ef140b90bd070354a430dc9 /core/java/android/os/Debug.java | |
| parent | 77dad606344a8951552585a3169fccd2ec3ccfd1 (diff) | |
| parent | 03eb67c287e6b03c1ef5e0b63973de577b6c2002 (diff) | |
Merge "Debug: Add attachJvmtiAgent with classloader" am: 940c0341f0 am: 878abd8e91
am: 03eb67c287
Change-Id: Ib3b8b14907253b3438588fda8b5059f61b5594cf
Diffstat (limited to 'core/java/android/os/Debug.java')
| -rw-r--r-- | core/java/android/os/Debug.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index 848ab88d3cbc..33e8c3e47b44 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -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); } } } |
