summaryrefslogtreecommitdiffstats
path: root/debuggerd
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-08-13 00:38:54 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-08-13 00:38:54 +0000
commit60083bed7502d49f7e4723045b0efb16ba85db69 (patch)
tree7a58f7e76a8dc3ee4649a7af138cbdea10f1e283 /debuggerd
parent81a3f71e45af5f19d426c7d0cc116ba3921d968a (diff)
parent7a746f3a6850198b7f1cad7f22befe9ca48b47fd (diff)
downloadsystem_core-60083bed7502d49f7e4723045b0efb16ba85db69.tar.gz
system_core-60083bed7502d49f7e4723045b0efb16ba85db69.tar.bz2
system_core-60083bed7502d49f7e4723045b0efb16ba85db69.zip
Merge "debuggerd: remove unnecessary arguments."
am: 7a746f3a68 Change-Id: I0a01639dd3096372eb5bbbe28362cdbf1c1da4af
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/client/debuggerd_client.cpp5
-rw-r--r--debuggerd/debuggerd.cpp12
-rw-r--r--debuggerd/include/debuggerd/client.h1
-rw-r--r--debuggerd/test/tombstone_test.cpp2
-rw-r--r--debuggerd/tombstone.cpp33
-rw-r--r--debuggerd/tombstone.h4
6 files changed, 24 insertions, 33 deletions
diff --git a/debuggerd/client/debuggerd_client.cpp b/debuggerd/client/debuggerd_client.cpp
index 44e92fedd..bbc724a5a 100644
--- a/debuggerd/client/debuggerd_client.cpp
+++ b/debuggerd/client/debuggerd_client.cpp
@@ -185,7 +185,7 @@ static bool have_siginfo(int signum) {
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 @@ static void send_debuggerd_packet(siginfo_t* info) {
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 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void*)
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 2de80b162..07e65e392 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 @@ struct debugger_request_t {
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 @@ static int read_request(int fd, debugger_request_t* out_request) {
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 @@ static bool perform_dump(const debugger_request_t& request, int fd, int tombston
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 @@ static bool perform_dump(const debugger_request_t& request, int fd, int tombston
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 41b7b3a1f..8225c73e5 100644
--- a/debuggerd/include/debuggerd/client.h
+++ b/debuggerd/include/debuggerd/client.h
@@ -44,7 +44,6 @@ typedef struct __attribute__((packed)) {
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 58d640e08..5ee07cda1 100644
--- a/debuggerd/test/tombstone_test.cpp
+++ b/debuggerd/test/tombstone_test.cpp
@@ -595,7 +595,7 @@ TEST_F(TombstoneTest, dump_signal_info_error) {
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 dfdf29cdf..935967812 100644
--- a/debuggerd/tombstone.cpp
+++ b/debuggerd/tombstone.cpp
@@ -176,7 +176,7 @@ static void dump_header_info(log_t* log) {
_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 @@ static void dump_signal_info(log_t* log, pid_t tid, int signal, int si_code) {
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_backtrace_and_stack(Backtrace* backtrace, log_t* log) {
}
}
-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 @@ static void dump_logs(log_t* log, pid_t pid, unsigned int tail) {
// 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 @@ static void dump_crash(log_t* log, BacktraceMap* map, pid_t pid, pid_t tid,
_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 @@ int open_tombstone(std::string* out_path) {
}
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 @@ void engrave_tombstone(int tombstone_fd, BacktraceMap* map, pid_t pid, pid_t tid
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 487d95058..e1c39c54e 100644
--- a/debuggerd/tombstone.h
+++ b/debuggerd/tombstone.h
@@ -33,7 +33,7 @@ int open_tombstone(std::string* path);
/* 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