[PATCH] D33159: [compiler-rt] Switch handle_<signal> flags from bool to int.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 18:09:24 PDT 2017


vitalybuka created this revision.
Herald added subscribers: dberris, kubamracek.

We are going to make it tri-state and remove allow_user_segv_handler.


https://reviews.llvm.org/D33159

Files:
  lib/sanitizer_common/sanitizer_flags.inc
  test/asan/TestCases/Posix/asan-sigbus.cpp


Index: test/asan/TestCases/Posix/asan-sigbus.cpp
===================================================================
--- test/asan/TestCases/Posix/asan-sigbus.cpp
+++ test/asan/TestCases/Posix/asan-sigbus.cpp
@@ -2,7 +2,7 @@
 // Defaults to true
 // RUN: %clangxx_asan -std=c++11 %s -o %t
 // RUN: not %run %t %T/file 2>&1 | FileCheck %s -check-prefix=CHECK-BUS
-// RUN: %env_asan_opts=handle_sigbus=false not --crash %run %t %T/file 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=handle_sigbus=0 not --crash %run %t %T/file 2>&1 | FileCheck %s
 
 // UNSUPPORTED: ios
 
Index: lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- lib/sanitizer_common/sanitizer_flags.inc
+++ lib/sanitizer_common/sanitizer_flags.inc
@@ -78,16 +78,15 @@
             "OS X only. 0 = don't print, 1 = print only once before process "
             "exits, 2 = print after each report.")
 COMMON_FLAG(bool, check_printf, true, "Check printf arguments.")
-COMMON_FLAG(bool, handle_segv, true,
-            "If set, registers the tool's custom SIGSEGV handler.")
-COMMON_FLAG(bool, handle_sigbus, true,
-            "If set, registers the tool's custom SIGBUS handler.")
-COMMON_FLAG(bool, handle_abort, false,
-            "If set, registers the tool's custom SIGABRT handler.")
-COMMON_FLAG(bool, handle_sigill, false,
-            "If set, registers the tool's custom SIGILL handler.")
-COMMON_FLAG(bool, handle_sigfpe, true,
-            "If set, registers the tool's custom SIGFPE handler.")
+#define COMMON_FLAG_HANDLE_SIGNAL_HELP(signal) \
+    "Controls custom tool's " #signal " handler (0 - do not registers the " \
+    "handler, 1 - register the handler). "
+COMMON_FLAG(int, handle_segv, 1, COMMON_FLAG_HANDLE_SIGNAL_HELP(SIGSEGV))
+COMMON_FLAG(int, handle_sigbus, 1, COMMON_FLAG_HANDLE_SIGNAL_HELP(SIGBUS))
+COMMON_FLAG(int, handle_abort, 0, COMMON_FLAG_HANDLE_SIGNAL_HELP(SIGABRT))
+COMMON_FLAG(int, handle_sigill, 0, COMMON_FLAG_HANDLE_SIGNAL_HELP(SIGILL))
+COMMON_FLAG(int, handle_sigfpe, 1, COMMON_FLAG_HANDLE_SIGNAL_HELP(SIGFPE))
+#undef COMMON_FLAG_HANDLE_SIGNAL_HELP
 COMMON_FLAG(bool, allow_user_segv_handler, true,
             "If set, allows user to register a SEGV handler even if the tool "
             "registers one.")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33159.98863.patch
Type: text/x-patch
Size: 2283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170513/42f07345/attachment.bin>


More information about the llvm-commits mailing list