summaryrefslogtreecommitdiff
path: root/debuggerd/libdebuggerd/backtrace.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2021-03-29 21:53:42 -0700
committerJosh Gao <jmgao@google.com>2021-03-30 12:15:56 -0700
commit31348a74e0708d8f51ee61b2fca2045f77e1f542 (patch)
treefc4484ce33e0d874d4e8acee745e3e9945f6ea56 /debuggerd/libdebuggerd/backtrace.cpp
parent5d5e16db570f1da4b4115317c9aed32e632007c1 (diff)
debuggerd: store commandline instead of process name.
Bug: http://b/180605583 Test: debuggerd_test Change-Id: I018d399a5460f357766dc1b429f645f78fe88565
Diffstat (limited to 'debuggerd/libdebuggerd/backtrace.cpp')
-rw-r--r--debuggerd/libdebuggerd/backtrace.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/debuggerd/libdebuggerd/backtrace.cpp b/debuggerd/libdebuggerd/backtrace.cpp
index c543a8392..fd9103824 100644
--- a/debuggerd/libdebuggerd/backtrace.cpp
+++ b/debuggerd/libdebuggerd/backtrace.cpp
@@ -34,6 +34,7 @@
#include <memory>
#include <string>
+#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <log/log.h>
#include <unwindstack/Unwinder.h>
@@ -42,11 +43,12 @@
#include "libdebuggerd/utility.h"
#include "util.h"
-static void dump_process_header(log_t* log, pid_t pid, const char* process_name) {
+static void dump_process_header(log_t* log, pid_t pid,
+ const std::vector<std::string>& command_line) {
_LOG(log, logtype::BACKTRACE, "\n\n----- pid %d at %s -----\n", pid, get_timestamp().c_str());
- if (process_name) {
- _LOG(log, logtype::BACKTRACE, "Cmd line: %s\n", process_name);
+ if (!command_line.empty()) {
+ _LOG(log, logtype::BACKTRACE, "Cmd line: %s\n", android::base::Join(command_line, " ").c_str());
}
_LOG(log, logtype::BACKTRACE, "ABI: '%s'\n", ABI_STRING);
}
@@ -89,7 +91,7 @@ void dump_backtrace(android::base::unique_fd output_fd, unwindstack::Unwinder* u
return;
}
- dump_process_header(&log, target->second.pid, target->second.process_name.c_str());
+ dump_process_header(&log, target->second.pid, target->second.command_line);
dump_backtrace_thread(output_fd.get(), unwinder, target->second);
for (const auto& [tid, info] : thread_info) {
@@ -107,7 +109,7 @@ void dump_backtrace_header(int output_fd) {
log.amfd_data = nullptr;
pid_t pid = getpid();
- dump_process_header(&log, pid, get_process_name(pid).c_str());
+ dump_process_header(&log, pid, get_command_line(pid));
}
void dump_backtrace_footer(int output_fd) {