← Android tombstones
Tombstone·Guide
All tools

The Tombstone tool

An Android native crash report — the tombstone debuggerd writes to /data/tombstones/tombstone_NN and prints in logcat — as an overview, the threads with their registers and backtraces, the memory around the registers, the memory map, the open files and the end of the logs. Drop the file, paste its text or use Open tombstone…; nothing leaves the browser.

Only the text format is read. The protobuf variant (tombstone_NN.pb) is recognised as binary; convert it with pbtombstone, or load the text file written next to it.

1Reading a tombstone

2The Tombstone library

lib/tombstone.js is a JavaScript module that reads the text, with no user interface and no dependencies; it also runs in a module Web Worker and in jsc. It exports one class, Tombstone, whose methods are all static; what it returns is plain data:

import { Tombstone } from "../lib/tombstone.js";
MethodWhat it does
Tombstone.parse(text){ preamble, records }, one record per banner, or { problem: { type, message } } with type "binary" (a protobuf tombstone) or "not-tombstone". A record has header (fingerprint, revision, abi, timestamp, uptime, cmdline), threads, crashed (the thread that got the signal), signal ({ number, name, code, codeName, faultAddress, fromPid, fromUid }), causes, abortMessage, taggedAddress, pacKeys, memoryNear ([{ register, path, rows: [{ address, words, ascii }] }]), memoryMap ({ count, entries, gaps }), openFiles ([{ fd, path, owner }]), logs ([{ channel, lines }]) and rawTail (lines not recognised).
thread, frame, mappingThread: { pid, tid, name, processName, uid, crashed, registers: [{ name, value }], totalFrames, frames, notes }. Frame: { number, pc, path, symbol, symbolOffset, buildId, deleted, fileOffset, origin }. Mapping: { index, low, high, permissions, offset, size, name, buildId, loadBias, deleted, fault, origin }, addresses and sizes as BigInts. origin is "app", "injected", "system", "anon", "other" or "unknown".
record lookupssortedMappings (by address), firstMappingByName (Map path → its first mapping), references (Map path → [{ thread, frame }]), injectedPaths, faultAddress (BigInt or null).
Tombstone.resolveAddress(record, address){ entry, offset }: the mapping that holds a BigInt address, or null.
Tombstone.frameAddress(record, frame)The frame's absolute address: its pc (an offset into the file) plus the start of the file's first mapping, or null.
Tombstone.mappingForPath(record, path)The first mapping of a file (a trailing (deleted) is ignored), or null.
Tombstone.backtraceText(record, thread)The thread's backtrace as text, in debuggerd's layout.
Tombstone.parseFrame(text)The text after #NN pc 0000…: { path, symbol, symbolOffset, buildId, deleted, fileOffset }, peeling the parenthesised groups from the right.
Tombstone.classifyPath(path)Where a file comes from (the origin above).
Tombstone.parseFingerprint(text)brand/product/device:release/id/incremental:type/tags as { raw, brand, product, device, release, buildId, incremental, buildType, tags }.
Tombstone.shortName(path)The file name of a path (libc.so; for base.apk!libfoo.so, libfoo.so).
Tombstone.looksLikeTombstone(text)Whether pasted text has a banner, a pid: line or a signal line.
Tombstone.SIGNAL_DESCRIPTIONSA short description of each common signal (SIGSEGV, SIGABRT, SIGTRAP…).
import { Tombstone } from "../lib/tombstone.js";

const result = Tombstone.parse(text);
if (result.problem) {
	throw new Error(result.problem.message);
}
for (const record of result.records) {
	const signal = record.signal;
	console.log(signal.name, signal.codeName, signal.faultAddress);
	const fault = Tombstone.resolveAddress(record, record.faultAddress);
	if (fault) {
		console.log("fault in", fault.entry.name, "at offset", fault.offset);
	}
	console.log(Tombstone.backtraceText(record, record.crashed));
	console.log("injected:", record.injectedPaths);
}