diff options
| author | Narayan Kamath <narayan@google.com> | 2017-05-09 12:55:02 +0100 |
|---|---|---|
| committer | Narayan Kamath <narayan@google.com> | 2017-06-02 13:55:10 +0100 |
| commit | f013daa3ac7718c983cf850784f5cf29ee027487 (patch) | |
| tree | 7fb7c0adcf84454b9cbc4446d9d140f09ceb20d8 /core/java/android/os/Debug.java | |
| parent | d47fa266e61ee20079767d7a7ce6e6bc42ad173b (diff) | |
ActivityManagerService: Add support for new stack dumping scheme.
Tombstoned now fully supports java traces and intercepts, and the
debuggerd dump API has been extended to support dumps of java traces.
This change switches ANR dumping over to using this API when the
right system property is set. The new flow is as follows :
- The system_server creates a new file using File.createTempFile for
each ANR detected by the activity manager. All dumps associated
with that ANR go into that file.
- All dumps are initiated using debuggerd client API (debuggerd_trigger_dump)
which handles all the timeout measurement for us. It can also
guarantee that no writes are made to the file after the method
returns, so we have no need of inotify watches and other fiddly
mechanisms to monitor progress. Also, this would give us the ability
to add meta-information about timeouts etc. to the dump file itself,
thougt that hasn't been implemented just yet.
Test: Manual
Bug: 32064548
Change-Id: I37e72c467e6dc29da4347c2a2829eeeeb1ad3490
Diffstat (limited to 'core/java/android/os/Debug.java')
| -rw-r--r-- | core/java/android/os/Debug.java | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index e05bd89079af..fa854b078292 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -16,13 +16,20 @@ package android.os; -import com.android.internal.util.FastPrintWriter; -import com.android.internal.util.TypedProperties; - import android.app.AppGlobals; import android.content.Context; import android.util.Log; +import com.android.internal.util.FastPrintWriter; +import com.android.internal.util.TypedProperties; + +import dalvik.bytecode.OpcodeInfo; +import dalvik.system.VMDebug; + +import org.apache.harmony.dalvik.ddmc.Chunk; +import org.apache.harmony.dalvik.ddmc.ChunkHandler; +import org.apache.harmony.dalvik.ddmc.DdmServer; + import java.io.File; import java.io.FileDescriptor; import java.io.FileNotFoundException; @@ -31,21 +38,16 @@ import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.io.Reader; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.lang.annotation.Target; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; -import org.apache.harmony.dalvik.ddmc.Chunk; -import org.apache.harmony.dalvik.ddmc.ChunkHandler; -import org.apache.harmony.dalvik.ddmc.DdmServer; -import dalvik.bytecode.OpcodeInfo; -import dalvik.system.VMDebug; /** @@ -2219,13 +2221,26 @@ public final class Debug } /** - * Append the stack traces of a given native process to a specified file. + * Append the Java stack traces of a given native process to a specified file. + * + * @param pid pid to dump. + * @param file path of file to append dump to. + * @param timeoutSecs time to wait in seconds, or 0 to wait forever. + * @hide + */ + public static native boolean dumpJavaBacktraceToFileTimeout(int pid, String file, + int timeoutSecs); + + /** + * Append the native stack traces of a given process to a specified file. + * * @param pid pid to dump. * @param file path of file to append dump to. * @param timeoutSecs time to wait in seconds, or 0 to wait forever. * @hide */ - public static native void dumpNativeBacktraceToFileTimeout(int pid, String file, int timeoutSecs); + public static native boolean dumpNativeBacktraceToFileTimeout(int pid, String file, + int timeoutSecs); /** * Get description of unreachable native memory. |
