From c7fe0600cc14f0324e8f603309c92263aefb7193 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 13 Mar 2017 14:13:29 -0700 Subject: [PATCH] crash_dump: fix warnings, turn on -Werror. Test: mma Change-Id: I0722fef7b513be976cbbe89f73e8bb7138a80442 --- debuggerd/Android.bp | 2 +- debuggerd/crash_dump.cpp | 8 ++++---- debuggerd/libdebuggerd/include/tombstone.h | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/debuggerd/Android.bp b/debuggerd/Android.bp index af84be9e4..b385ea52b 100644 --- a/debuggerd/Android.bp +++ b/debuggerd/Android.bp @@ -3,7 +3,7 @@ cc_defaults { cflags: [ "-Wall", "-Wextra", - "-Wno-error", + "-Werror", "-Wno-nullability-completeness", "-Os", ], diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp index 57a6c448a..38b711ff4 100644 --- a/debuggerd/crash_dump.cpp +++ b/debuggerd/crash_dump.cpp @@ -199,10 +199,6 @@ int main(int argc, char** argv) { pid_t main_tid; pid_t pseudothread_tid; - if (target == 1) { - LOG(FATAL) << "target died before we could attach (received main tid = " << main_tid << ")"; - } - if (!android::base::ParseInt(argv[1], &main_tid, 1, std::numeric_limits::max())) { LOG(FATAL) << "invalid main tid: " << argv[1]; } @@ -211,6 +207,10 @@ int main(int argc, char** argv) { LOG(FATAL) << "invalid pseudothread tid: " << argv[2]; } + if (target == 1) { + LOG(FATAL) << "target died before we could attach (received main tid = " << main_tid << ")"; + } + android::procinfo::ProcessInfo target_info; if (!android::procinfo::GetProcessInfo(main_tid, &target_info)) { LOG(FATAL) << "failed to fetch process info for target " << main_tid; diff --git a/debuggerd/libdebuggerd/include/tombstone.h b/debuggerd/libdebuggerd/include/tombstone.h index 8e6027841..d2a4a4bb7 100644 --- a/debuggerd/libdebuggerd/include/tombstone.h +++ b/debuggerd/libdebuggerd/include/tombstone.h @@ -43,6 +43,7 @@ void engrave_tombstone_ucontext(int tombstone_fd, uintptr_t abort_msg_address, s ucontext_t* ucontext); // Compatibility shim. +__attribute__((__unused__)) static void engrave_tombstone_ucontext(int tombstone_fd, pid_t, pid_t, uintptr_t abort_msg_address, siginfo_t* siginfo, ucontext_t* ucontext) { engrave_tombstone_ucontext(tombstone_fd, abort_msg_address, siginfo, ucontext);