Merge "debuggerd: remove unnecessary arguments."
am: 7a746f3a68
Change-Id: I0a01639dd3096372eb5bbbe28362cdbf1c1da4af
diff --git a/debuggerd/client/debuggerd_client.cpp b/debuggerd/client/debuggerd_client.cpp
index 44e92fe..bbc724a 100644
--- a/debuggerd/client/debuggerd_client.cpp
+++ b/debuggerd/client/debuggerd_client.cpp
@@ -185,7 +185,7 @@
return result;
}
-static void send_debuggerd_packet(siginfo_t* info) {
+static void send_debuggerd_packet() {
// Mutex to prevent multiple crashing threads from trying to talk
// to debuggerd at the same time.
static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -222,7 +222,6 @@
msg.abort_msg_address = reinterpret_cast<uintptr_t>(g_callbacks.get_abort_message());
}
- msg.original_si_code = (info != nullptr) ? info->si_code : 0;
ret = TEMP_FAILURE_RETRY(write(s, &msg, sizeof(msg)));
if (ret == sizeof(msg)) {
char debuggerd_ack;
@@ -254,7 +253,7 @@
log_signal_summary(signal_number, info);
- send_debuggerd_packet(info);
+ send_debuggerd_packet();
// We need to return from the signal handler so that debuggerd can dump the
// thread that crashed, but returning here does not guarantee that the signal
diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp
index 2de80b1..07e65e3 100644
--- a/debuggerd/debuggerd.cpp
+++ b/debuggerd/debuggerd.cpp
@@ -51,6 +51,8 @@
#include <private/android_filesystem_config.h>
+#include <debuggerd/client.h>
+
#include "backtrace.h"
#include "getevent.h"
#include "signal_sender.h"
@@ -70,7 +72,6 @@
pid_t pid, tid;
uid_t uid, gid;
uintptr_t abort_msg_address;
- int32_t original_si_code;
};
static void wait_for_user_action(const debugger_request_t& request) {
@@ -222,7 +223,6 @@
out_request->uid = cr.uid;
out_request->gid = cr.gid;
out_request->abort_msg_address = msg.abort_msg_address;
- out_request->original_si_code = msg.original_si_code;
if (msg.action == DEBUGGER_ACTION_CRASH) {
// Ensure that the tid reported by the crashing process is valid.
@@ -471,8 +471,8 @@
case SIGSTOP:
if (request.action == DEBUGGER_ACTION_DUMP_TOMBSTONE) {
ALOGV("debuggerd: stopped -- dumping to tombstone");
- engrave_tombstone(tombstone_fd, backtrace_map, request.pid, request.tid, siblings, signal,
- request.original_si_code, request.abort_msg_address, amfd_data);
+ engrave_tombstone(tombstone_fd, backtrace_map, request.pid, request.tid, siblings,
+ request.abort_msg_address, amfd_data);
} else if (request.action == DEBUGGER_ACTION_DUMP_BACKTRACE) {
ALOGV("debuggerd: stopped -- dumping to fd");
dump_backtrace(fd, backtrace_map, request.pid, request.tid, siblings, nullptr);
@@ -498,8 +498,8 @@
case SIGTRAP:
ALOGV("stopped -- fatal signal\n");
*crash_signal = signal;
- engrave_tombstone(tombstone_fd, backtrace_map, request.pid, request.tid, siblings, signal,
- request.original_si_code, request.abort_msg_address, amfd_data);
+ engrave_tombstone(tombstone_fd, backtrace_map, request.pid, request.tid, siblings,
+ request.abort_msg_address, amfd_data);
break;
default:
diff --git a/debuggerd/include/debuggerd/client.h b/debuggerd/include/debuggerd/client.h
index 41b7b3a..8225c73 100644
--- a/debuggerd/include/debuggerd/client.h
+++ b/debuggerd/include/debuggerd/client.h
@@ -44,7 +44,6 @@
int32_t action;
pid_t tid;
uint64_t abort_msg_address;
- int32_t original_si_code;
} debugger_msg_t;
// These callbacks are called in a signal handler, and thus must be async signal safe.
diff --git a/debuggerd/test/tombstone_test.cpp b/debuggerd/test/tombstone_test.cpp
index 58d640e..5ee07cd 100644
--- a/debuggerd/test/tombstone_test.cpp
+++ b/debuggerd/test/tombstone_test.cpp
@@ -595,7 +595,7 @@
si.si_signo = 0;
ptrace_set_fake_getsiginfo(si);
- dump_signal_info(&log_, 123, SIGSEGV, 10);
+ dump_signal_info(&log_, 123);
std::string tombstone_contents;
ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp
index dfdf29c..9359678 100644
--- a/debuggerd/tombstone.cpp
+++ b/debuggerd/tombstone.cpp
@@ -176,7 +176,7 @@
_LOG(log, logtype::HEADER, "ABI: '%s'\n", ABI_STRING);
}
-static void dump_signal_info(log_t* log, pid_t tid, int signal, int si_code) {
+static void dump_signal_info(log_t* log, pid_t tid) {
siginfo_t si;
memset(&si, 0, sizeof(si));
if (ptrace(PTRACE_GETSIGINFO, tid, 0, &si) == -1) {
@@ -184,18 +184,15 @@
return;
}
- // bionic has to re-raise some signals, which overwrites the si_code with SI_TKILL.
- si.si_code = si_code;
-
char addr_desc[32]; // ", fault addr 0x1234"
- if (signal_has_si_addr(signal)) {
+ if (signal_has_si_addr(si.si_signo)) {
snprintf(addr_desc, sizeof(addr_desc), "%p", si.si_addr);
} else {
snprintf(addr_desc, sizeof(addr_desc), "--------");
}
- _LOG(log, logtype::HEADER, "signal %d (%s), code %d (%s), fault addr %s\n",
- signal, get_signame(signal), si.si_code, get_sigcode(signal, si.si_code), addr_desc);
+ _LOG(log, logtype::HEADER, "signal %d (%s), code %d (%s), fault addr %s\n", si.si_signo,
+ get_signame(si.si_signo), si.si_code, get_sigcode(si.si_signo, si.si_code), addr_desc);
}
static void dump_thread_info(log_t* log, pid_t pid, pid_t tid) {
@@ -445,17 +442,14 @@
}
}
-static void dump_thread(log_t* log, pid_t pid, pid_t tid, BacktraceMap* map, int signal,
- int si_code, uintptr_t abort_msg_address, bool primary_thread) {
+static void dump_thread(log_t* log, pid_t pid, pid_t tid, BacktraceMap* map,
+ uintptr_t abort_msg_address, bool primary_thread) {
log->current_tid = tid;
if (!primary_thread) {
_LOG(log, logtype::THREAD, "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n");
}
dump_thread_info(log, pid, tid);
-
- if (signal) {
- dump_signal_info(log, tid, signal, si_code);
- }
+ dump_signal_info(log, tid);
std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, tid, map));
if (primary_thread) {
@@ -606,8 +600,7 @@
// Dumps all information about the specified pid to the tombstone.
static void dump_crash(log_t* log, BacktraceMap* map, pid_t pid, pid_t tid,
- const std::set<pid_t>& siblings, int signal, int si_code,
- uintptr_t abort_msg_address) {
+ const std::set<pid_t>& siblings, uintptr_t abort_msg_address) {
// don't copy log messages to tombstone unless this is a dev device
char value[PROPERTY_VALUE_MAX];
property_get("ro.debuggable", value, "0");
@@ -616,14 +609,14 @@
_LOG(log, logtype::HEADER,
"*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
dump_header_info(log);
- dump_thread(log, pid, tid, map, signal, si_code, abort_msg_address, true);
+ dump_thread(log, pid, tid, map, abort_msg_address, true);
if (want_logs) {
dump_logs(log, pid, 5);
}
if (!siblings.empty()) {
for (pid_t sibling : siblings) {
- dump_thread(log, pid, sibling, map, 0, 0, 0, false);
+ dump_thread(log, pid, sibling, map, 0, false);
}
}
@@ -686,8 +679,8 @@
}
void engrave_tombstone(int tombstone_fd, BacktraceMap* map, pid_t pid, pid_t tid,
- const std::set<pid_t>& siblings, int signal, int original_si_code,
- uintptr_t abort_msg_address, std::string* amfd_data) {
+ const std::set<pid_t>& siblings, uintptr_t abort_msg_address,
+ std::string* amfd_data) {
log_t log;
log.current_tid = tid;
log.crashed_tid = tid;
@@ -699,5 +692,5 @@
log.tfd = tombstone_fd;
log.amfd_data = amfd_data;
- dump_crash(&log, map, pid, tid, siblings, signal, original_si_code, abort_msg_address);
+ dump_crash(&log, map, pid, tid, siblings, abort_msg_address);
}
diff --git a/debuggerd/tombstone.h b/debuggerd/tombstone.h
index 487d950..e1c39c5 100644
--- a/debuggerd/tombstone.h
+++ b/debuggerd/tombstone.h
@@ -33,7 +33,7 @@
/* Creates a tombstone file and writes the crash dump to it. */
void engrave_tombstone(int tombstone_fd, BacktraceMap* map, pid_t pid, pid_t tid,
- const std::set<pid_t>& siblings, int signal, int original_si_code,
- uintptr_t abort_msg_address, std::string* amfd_data);
+ const std::set<pid_t>& siblings, uintptr_t abort_msg_address,
+ std::string* amfd_data);
#endif // _DEBUGGERD_TOMBSTONE_H