summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_fallback.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2020-11-09 14:42:01 -0800
committerJosh Gao <jmgao@google.com>2021-01-21 15:40:23 -0800
commit92317d82c970cea68884c3e9efbb5d6441dd6fa2 (patch)
tree645cf2815080af43bcb156fc7a9dda5258084ec2 /debuggerd/handler/debuggerd_fallback.cpp
parent1091d24c162572c31e716d97b01a306ebce4d377 (diff)
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
Diffstat (limited to 'debuggerd/handler/debuggerd_fallback.cpp')
-rw-r--r--debuggerd/handler/debuggerd_fallback.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/debuggerd/handler/debuggerd_fallback.cpp b/debuggerd/handler/debuggerd_fallback.cpp
index e103c82f4..feafa7377 100644
--- a/debuggerd/handler/debuggerd_fallback.cpp
+++ b/debuggerd/handler/debuggerd_fallback.cpp
@@ -92,15 +92,15 @@ static void debuggerd_fallback_trace(int output_fd, ucontext_t* ucontext) {
__linker_disable_fallback_allocator();
}
-static void debuggerd_fallback_tombstone(int output_fd, ucontext_t* ucontext, siginfo_t* siginfo,
- void* abort_message) {
+static void debuggerd_fallback_tombstone(int output_fd, int proto_fd, ucontext_t* ucontext,
+ siginfo_t* siginfo, void* abort_message) {
if (!__linker_enable_fallback_allocator()) {
async_safe_format_log(ANDROID_LOG_ERROR, "libc", "fallback allocator already in use");
return;
}
- engrave_tombstone_ucontext(output_fd, reinterpret_cast<uintptr_t>(abort_message), siginfo,
- ucontext);
+ engrave_tombstone_ucontext(output_fd, proto_fd, reinterpret_cast<uintptr_t>(abort_message),
+ siginfo, ucontext);
__linker_disable_fallback_allocator();
}
@@ -232,7 +232,8 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
// Fetch output fd from tombstoned.
unique_fd tombstone_socket, output_fd;
- if (!tombstoned_connect(getpid(), &tombstone_socket, &output_fd, kDebuggerdNativeBacktrace)) {
+ if (!tombstoned_connect(getpid(), &tombstone_socket, &output_fd, nullptr,
+ kDebuggerdNativeBacktrace)) {
async_safe_format_log(ANDROID_LOG_ERROR, "libc",
"missing crash_dump_fallback() in selinux policy?");
goto exit;
@@ -325,10 +326,10 @@ static void crash_handler(siginfo_t* info, ucontext_t* ucontext, void* abort_mes
_exit(1);
}
- unique_fd tombstone_socket, output_fd;
- bool tombstoned_connected =
- tombstoned_connect(getpid(), &tombstone_socket, &output_fd, kDebuggerdTombstone);
- debuggerd_fallback_tombstone(output_fd.get(), ucontext, info, abort_message);
+ unique_fd tombstone_socket, output_fd, proto_fd;
+ bool tombstoned_connected = tombstoned_connect(getpid(), &tombstone_socket, &output_fd, &proto_fd,
+ kDebuggerdTombstoneProto);
+ debuggerd_fallback_tombstone(output_fd.get(), proto_fd.get(), ucontext, info, abort_message);
if (tombstoned_connected) {
tombstoned_notify_completion(tombstone_socket.get());
}