1 //=-- lsan.h --------------------------------------------------------------===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of LeakSanitizer.
9 // Private header for standalone LSan RTL.
11 //===----------------------------------------------------------------------===//
13 #include "sanitizer_common/sanitizer_flags.h"
14 #include "sanitizer_common/sanitizer_stacktrace.h"
16 #define GET_STACK_TRACE(max_size, fast) \
17 BufferedStackTrace stack; \
19 uptr stack_top = 0, stack_bottom = 0; \
21 if (fast && (t = CurrentThreadContext())) { \
22 stack_top = t->stack_end(); \
23 stack_bottom = t->stack_begin(); \
25 stack.Unwind(max_size, StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \
26 /* context */ 0, stack_top, stack_bottom, fast); \
29 #define GET_STACK_TRACE_FATAL \
30 GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
32 #define GET_STACK_TRACE_MALLOC \
33 GET_STACK_TRACE(__sanitizer::common_flags()->malloc_context_size, \
34 common_flags()->fast_unwind_on_malloc)
38 void InitializeInterceptors();
42 extern bool lsan_inited
;
43 extern bool lsan_init_is_running
;
45 extern "C" void __lsan_init();