androidadbandroid-logcat

Default tombstones location in android


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?


Solution

  • 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