diff options
author | Elliott Hughes <enh@google.com> | 2017-03-02 19:01:20 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2017-03-02 19:01:20 -0800 |
commit | 12b71294064e6dc0a225e19ce179e702f481d6a6 (patch) | |
tree | a07e323818f5a5cda55eca1fdc34b2616aa53a58 /debuggerd/debuggerd.cpp | |
parent | 22cc398d76b8e0e305b74dbaf1f9fc4eded7791f (diff) |
Small debuggerd improvements.
Include the ABI in seccomp causes.
Slightly improved command-line usage information.
Fix crasher for seccomp failures.
Bug: N/A
Test: crasher
Change-Id: Ie419ecfe72ee4f5ccf49c927be18350a58a66a90
Diffstat (limited to 'debuggerd/debuggerd.cpp')
-rw-r--r-- | debuggerd/debuggerd.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp index 0c5d3cf9b..492e9f023 100644 --- a/debuggerd/debuggerd.cpp +++ b/debuggerd/debuggerd.cpp @@ -34,6 +34,8 @@ using android::base::unique_fd; static void usage(int exit_code) { fprintf(stderr, "usage: debuggerd [-b] PID\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "-b, --backtrace just a backtrace rather than a full tombstone\n"); _exit(exit_code); } @@ -56,7 +58,8 @@ static std::thread spawn_redirect_thread(unique_fd fd) { int main(int argc, char* argv[]) { if (argc <= 1) usage(0); if (argc > 3) usage(1); - if (argc == 3 && strcmp(argv[1], "-b") != 0) usage(1); + if (argc == 3 && strcmp(argv[1], "-b") != 0 && strcmp(argv[1], "--backtrace") != 0) usage(1); + bool backtrace_only = argc == 3; pid_t pid; if (!android::base::ParseInt(argv[argc - 1], &pid, 1, std::numeric_limits<pid_t>::max())) { @@ -69,9 +72,8 @@ int main(int argc, char* argv[]) { } std::thread redirect_thread = spawn_redirect_thread(std::move(piperead)); - bool backtrace = argc == 3; if (!debuggerd_trigger_dump(pid, std::move(pipewrite), - backtrace ? kDebuggerdBacktrace : kDebuggerdTombstone, 0)) { + backtrace_only ? kDebuggerdBacktrace : kDebuggerdTombstone, 0)) { redirect_thread.join(); errx(1, "failed to dump process %d", pid); } |