libdebuggerd: add protobuf implementation.
This commit implements protobuf output for tombstones, along with a
translator that should emit bytewise identical output to the existing
tombstone dumping code, except for ancillary data from GWP-ASan and
Scudo, which haven't been implemented yet.
Test: setprop debug.debuggerd.translate.translate_proto_to_text 1 &&
/data/nativetest64/debuggerd_test/debuggerd_test
Test: for TOMBSTONE in /data/tombstones/tombstone_??; do
pbtombstone $TOMBSTONE.pb | diff $TOMBSTONE -
done
Change-Id: Ieeece6e6d1c26eb608b00ec24e2e725e161c8c92
diff --git a/debuggerd/proto/tombstone.proto b/debuggerd/proto/tombstone.proto
new file mode 100644
index 0000000..aff50bd
--- /dev/null
+++ b/debuggerd/proto/tombstone.proto
@@ -0,0 +1,118 @@
+syntax = "proto3";
+
+message Tombstone {
+ Architecture arch = 1;
+ string build_fingerprint = 2;
+ string revision = 3;
+ string timestamp = 4;
+
+ uint32 pid = 5;
+ uint32 tid = 6;
+ uint32 uid = 7;
+ string selinux_label = 8;
+
+ string process_name = 9;
+
+ Signal signal_info = 10;
+ string abort_message = 14;
+ Cause cause = 15;
+
+ map<uint32, Thread> threads = 16;
+ repeated MemoryMapping memory_mappings = 17;
+ repeated LogBuffer log_buffers = 18;
+ repeated FD open_fds = 19;
+}
+
+enum Architecture {
+ ARM32 = 0;
+ ARM64 = 1;
+ X86 = 2;
+ X86_64 = 3;
+}
+
+message Signal {
+ int32 number = 1;
+ string name = 2;
+
+ int32 code = 3;
+ string code_name = 4;
+
+ bool has_sender = 5;
+ int32 sender_uid = 6;
+ int32 sender_pid = 7;
+
+ bool has_fault_address = 8;
+ uint64 fault_address = 9;
+}
+
+message Cause {
+ string human_readable = 1;
+}
+
+message Register {
+ string name = 1;
+ uint64 u64 = 2;
+}
+
+message Thread {
+ int32 id = 1;
+ string name = 2;
+ repeated Register registers = 3;
+ repeated BacktraceFrame current_backtrace = 4;
+ repeated MemoryDump memory_dump = 5;
+}
+
+message BacktraceFrame {
+ uint64 rel_pc = 1;
+ uint64 pc = 2;
+ uint64 sp = 3;
+
+ string function_name = 4;
+ uint64 function_offset = 5;
+
+ string file_name = 6;
+ uint64 file_map_offset = 7;
+ string build_id = 8;
+}
+
+message MemoryDump {
+ string register_name = 1;
+ string mapping_name = 2;
+ uint64 begin_address = 3;
+ bytes memory = 4;
+}
+
+message MemoryMapping {
+ uint64 begin_address = 1;
+ uint64 end_address = 2;
+ uint64 offset = 3;
+
+ bool read = 4;
+ bool write = 5;
+ bool execute = 6;
+
+ string mapping_name = 7;
+ string build_id = 8;
+ uint64 load_bias = 9;
+}
+
+message FD {
+ int32 fd = 1;
+ string path = 2;
+ string owner = 3;
+ uint64 tag = 4;
+}
+
+message LogBuffer {
+ string name = 1;
+ repeated LogMessage logs = 2;
+}
+
+message LogMessage {
+ string timestamp = 1;
+ uint32 pid = 2;
+ uint32 tid = 3;
+ uint32 priority = 4;
+ string tag = 5;
+ string message = 6;
+}