Resolve ro.debuggable at build time am: d5e026e1af

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/21106623

Change-Id: I7a10a9a5f3397862aba9c2833d71fdf01bad4630
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alessandra Loro 2023-01-26 01:37:30 +00:00 committed by Automerger Merge Worker
commit 1de6ea34c3
2 changed files with 10 additions and 3 deletions

View file

@ -14,9 +14,15 @@ cc_defaults {
"-Wno-nullability-completeness",
"-Os",
"-fno-finite-loops",
"-DANDROID_DEBUGGABLE=0",
],
local_include_dirs: ["include"],
product_variables: {
debuggable: {
cflags: ["-UANDROID_DEBUGGABLE", "-DANDROID_DEBUGGABLE=1"],
}
},
}
cc_library_headers {

View file

@ -62,10 +62,11 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks);
#define DEBUGGER_SIGNAL BIONIC_SIGNAL_DEBUGGER
static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigaction* action) {
bool enabled = true;
#if ANDROID_DEBUGGABLE
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"));
enabled = !(__system_property_get("debug.debuggerd.disable", value) > 0 && !strcmp(value, "1"));
#endif
if (enabled) {
sigaction(SIGABRT, action, nullptr);
sigaction(SIGBUS, action, nullptr);