[PATCH] [Sanitizers] Enable stack traces on FreeBSD

Alexey Samsonov vonosmas at gmail.com
Wed Nov 5 18:41:28 PST 2014


================
Comment at: lib/asan/asan_posix.cc:50
@@ -49,1 +49,3 @@
+  CHECK_EQ(false, in_sigsegv_handler);
+  in_sigsegv_handler = true;
   if (addr + 128 > sp && addr < sp + 0xFFFF &&
----------------
I'd prefer to have RAII object that sets/unsets it. Also, won't we have a data race when one thread checks if it wants to use a fast unwind (e.g. to save an alllocation stack), and another thread hits a segfault and invokes a signal handler?

================
Comment at: lib/sanitizer_common/sanitizer_internal_defs.h:214
@@ -213,1 +213,3 @@
+
+extern bool in_sigsegv_handler;
 }  // namespace __sanitizer
----------------
Please put this in sanitizer_common.h. Also, there are other options apart from SEGV, in_deadly_signal_handler would be a more proper name.

================
Comment at: lib/sanitizer_common/sanitizer_stacktrace.cc:20
@@ -19,1 +19,3 @@
 
+bool in_sigsegv_handler = false;
+
----------------
sanitizer_common.cc

================
Comment at: lib/sanitizer_common/sanitizer_stacktrace.h:18
@@ -17,1 +17,3 @@
 
+#if SANITIZER_FREEBSD
+#include <osreldate.h>  // for __FreeBSD_version
----------------
Do you still need this?

http://reviews.llvm.org/D6086






More information about the llvm-commits mailing list