Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67364336 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "debuggerd: add an opt-out for OEMs that would rather collect core...

Merge "debuggerd: add an opt-out for OEMs that would rather collect core dumps." into rvc-dev am: 5f3afb21

Change-Id: Ic5df8ec0d5c763b0121c4360ba654e347f97b89f
parents 85911274 5f3afb21
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@
#include <bionic/reserved_signals.h>
#include <signal.h>
#include <stdint.h>
#include <string.h>
#include <sys/cdefs.h>
#include <sys/system_properties.h>
#include <sys/types.h>

__BEGIN_DECLS
@@ -50,16 +52,21 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks);
#define DEBUGGER_SIGNAL BIONIC_SIGNAL_DEBUGGER

static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigaction* action) {
  char value[PROP_VALUE_MAX] = "";
  bool enabled =
      !(__system_property_get("ro.debuggable", value) > 0 && !strcmp(value, "1") &&
        __system_property_get("debug.debuggerd.disable", value) > 0 && !strcmp(value, "1"));
  if (enabled) {
    sigaction(SIGABRT, action, nullptr);
    sigaction(SIGBUS, action, nullptr);
    sigaction(SIGFPE, action, nullptr);
    sigaction(SIGILL, action, nullptr);
    sigaction(SIGSEGV, action, nullptr);
#if defined(SIGSTKFLT)
    sigaction(SIGSTKFLT, action, nullptr);
#endif
    sigaction(SIGSYS, action, nullptr);
    sigaction(SIGTRAP, action, nullptr);
  }

  sigaction(BIONIC_SIGNAL_DEBUGGER, action, nullptr);
}