[PATCH] [lsan] Add __lsan_disable() and __lsan_enable().

Kostya Serebryany kcc at google.com
Fri May 31 07:26:07 PDT 2013



================
Comment at: lib/asan/asan_thread.h:70
@@ -68,1 +69,3 @@
+  void disable_lsan() { lsan_disabled_++; }
+  void enable_lsan() { if (lsan_disabled_) lsan_disabled_--; }
   u32 tid() { return context_->tid; }
----------------
We better have a CHECK here instead of if 

================
Comment at: lib/lsan/lit_tests/TestCases/disabler.cc:1
@@ +1,2 @@
+// Test that stack of main thread is included in the root set.
+// RUN: LSAN_OPTIONS="report_blocks=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0"
----------------
is the comment right?

================
Comment at: lib/lsan/lit_tests/TestCases/disabler.cc:4
@@ +3,3 @@
+// RUN: %clangxx_lsan -I %p/../../../../include %s -o %t
+// RUN: %t 2>&1
+
----------------
is LSAN_OPTIONS exported? 

================
Comment at: lib/lsan/lit_tests/TestCases/disabler.cc:12
@@ +11,3 @@
+int main() {
+  void *p;
+  {
----------------
declare this as void **
and you can use new instead of malloc

================
Comment at: lib/lsan/lsan_allocator.cc:204
@@ +203,3 @@
+void __lsan_enable() {
+  if (__lsan::disabled) __lsan::disabled--;
+}
----------------
s/if/CHECK/


http://llvm-reviews.chandlerc.com/D900



More information about the llvm-commits mailing list