summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debuggerd/crash_dump.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp
index a1f021184..40cf6c340 100644
--- a/debuggerd/crash_dump.cpp
+++ b/debuggerd/crash_dump.cpp
@@ -190,6 +190,19 @@ static bool g_tombstoned_connected = false;
190static unique_fd g_tombstoned_socket; 190static unique_fd g_tombstoned_socket;
191static unique_fd g_output_fd; 191static unique_fd g_output_fd;
192 192
193static void DefuseSignalHandlers() {
194 // Don't try to dump ourselves.
195 struct sigaction action = {};
196 action.sa_handler = SIG_DFL;
197 debuggerd_register_handlers(&action);
198
199 sigset_t mask;
200 sigemptyset(&mask);
201 if (sigprocmask(SIG_SETMASK, &mask, nullptr) != 0) {
202 PLOG(FATAL) << "failed to set signal mask";
203 }
204}
205
193static void Initialize(char** argv) { 206static void Initialize(char** argv) {
194 android::base::InitLogging(argv); 207 android::base::InitLogging(argv);
195 android::base::SetAborter([](const char* abort_msg) { 208 android::base::SetAborter([](const char* abort_msg) {
@@ -213,17 +226,6 @@ static void Initialize(char** argv) {
213 226
214 _exit(1); 227 _exit(1);
215 }); 228 });
216
217 // Don't try to dump ourselves.
218 struct sigaction action = {};
219 action.sa_handler = SIG_DFL;
220 debuggerd_register_handlers(&action);
221
222 sigset_t mask;
223 sigemptyset(&mask);
224 if (sigprocmask(SIG_SETMASK, &mask, nullptr) != 0) {
225 PLOG(FATAL) << "failed to set signal mask";
226 }
227} 229}
228 230
229static void ParseArgs(int argc, char** argv, pid_t* pseudothread_tid, DebuggerdDumpType* dump_type) { 231static void ParseArgs(int argc, char** argv, pid_t* pseudothread_tid, DebuggerdDumpType* dump_type) {
@@ -321,6 +323,8 @@ static pid_t wait_for_vm_process(pid_t pseudothread_tid) {
321} 323}
322 324
323int main(int argc, char** argv) { 325int main(int argc, char** argv) {
326 DefuseSignalHandlers();
327
324 atrace_begin(ATRACE_TAG, "before reparent"); 328 atrace_begin(ATRACE_TAG, "before reparent");
325 pid_t target_process = getppid(); 329 pid_t target_process = getppid();
326 330