Don't use PR_SET_DUMPABLE to prevent crash dumping in death tests.

Bug: http://b/27833000
Test: bionic-unit-tests are way faster
Change-Id: I6ae029edcd4c4b4b0dfaf613fc17c208d3cb24d1
diff --git a/tests/BionicDeathTest.h b/tests/BionicDeathTest.h
index 31d2d6e..3e8d7b2 100644
--- a/tests/BionicDeathTest.h
+++ b/tests/BionicDeathTest.h
@@ -17,25 +17,29 @@
 #ifndef BIONIC_TESTS_BIONIC_DEATH_TEST_H_
 #define BIONIC_TESTS_BIONIC_DEATH_TEST_H_
 
-#include <gtest/gtest.h>
+#include <signal.h>
 
-#include <sys/prctl.h>
+#include <gtest/gtest.h>
 
 class BionicDeathTest : public testing::Test {
  protected:
   virtual void SetUp() {
     // Suppress debuggerd stack traces. Too slow.
-    old_dumpable_ = prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
-    prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
-    ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+    for (int signo : { SIGABRT, SIGBUS, SIGSEGV, SIGSYS }) {
+      struct sigaction action = {};
+      action.sa_handler = SIG_DFL;
+      sigaction(signo, &action, &previous_);
+    }
   }
 
   virtual void TearDown() {
-    prctl(PR_SET_DUMPABLE, old_dumpable_, 0, 0, 0, 0);
+    for (int signo : { SIGABRT, SIGBUS, SIGSEGV, SIGSYS }) {
+      sigaction(signo, &previous_, nullptr);
+    }
   }
 
  private:
-  int old_dumpable_;
+  struct sigaction previous_;
 };
 
 #endif // BIONIC_TESTS_BIONIC_DEATH_TEST_H_