11

I am writing an app to capture tombstones logs.

How to get the default location of tombstones logs in any Android device? Even if the tombstones logs are not available yet, where do they get stored when any crash or something happen? AFAIK these logs get saved in '/data/tombstones/' but is this path universal across all devices? Do I need to read some property from "adb shell getprop" etc in the code dynamically?

darthvading
  • 909
  • 2
  • 11
  • 25

4 Answers4

11

If you haven't rooted you device, you should use bugreport adb command:

adb bugreport ./bugreport.zip

Inside the zip you will have everything you need to analyse.

In order to disassembly the tombstone:

  1. get the AOSP source code and follow the instructions of the https://source.android.com/setup/start until the lunch command.

  2. Run the command (replace tombstone_01 by the interest file):

disassemble_tombstone.py ./bugreport/FS/data/tombstones/tombstone_01

More tools do debug the bugreport.zip in https://source.android.com/devices/tech/debug

  • Also, if the device is Android < 7.0, only a plaintext bug report dump is available, so your first command would become something like `adb bugreport > ./bugreport.txt` – Pyr3z Aug 22 '23 at 22:18
9

Not to say this can't change in the future (and of course, being open source any vendor could modify this if they choose), but tombstone files are written by debuggerd in the engrave_tombstone() function implemented in tombstone.cpp (formerly tombstone.c):

This uses a hardcoded path using the macro:

#define TOMBSTONE_DIR "/data/tombstones"

Even the Java side of Android uses the hardcoded path:

And it appears that using /data/tombstones goes at least back to Android 1.6 Donut's debuggerd

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
3

You may run below command at "/" directory from "adb shell" to locate tombstones location for a specific device.

find . |grep tombs
AADProgramming
  • 6,077
  • 11
  • 38
  • 58
-3

The path is NOT universal, in fact that isn't one I've seen in a long time. Generally when a tombstone occurs you get a line in logcat saying where the logs are. Otherwise you need to poke around.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127