Android backtrace
android_backtraceCapture stack traces for an Android app. Dumps all threads via ART's kill -3 from /data/anr/; if permissions block, falls back to logcat crash buffer. Use engine and note to interpret results.
Instructions
Capture stack traces for an app. Asks ART to dump every thread (kill -3, the same mechanism that produces an ANR trace) and reads the newest file from /data/anr/. On most PRODUCTION devices the adb shell user may neither signal another app nor read that directory, so the tool then degrades to the crash log buffer (logcat -b crash) and reports engine:"logcat-crash" — always read engine and note before concluding anything: a logcat-crash result shows the LAST CRASH, not the current stacks, and an empty one means "no crash was recorded", never "the app has no stack". Emulators and rooted/debuggable builds usually get the real engine:"anr-trace".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | No | Explicit pid to signal (from android_processes), overriding package_name resolution. | |
| device | No | Target adb serial. Defaults to the streamed device, else the only online one. | |
| all_threads | No | Keep every thread’s stack (default true). false keeps roughly the first thread block, which is usually the main thread. | |
| package_name | No | Android package to dump, e.g. "com.example.app". Its pid is resolved with `pidof -s`; when the app is not running only the crash buffer can answer. |