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 if (!SANITIZER_MIPS || \
26 IsValidFrame(GET_CURRENT_FRAME(), stack_top, stack_bottom)) { \
27 stack.Unwind(max_size, StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \
28 /* context */ 0, stack_top, stack_bottom, fast); \
32 #define GET_STACK_TRACE_FATAL \
33 GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
35 #define GET_STACK_TRACE_MALLOC \
36 GET_STACK_TRACE(__sanitizer::common_flags()->malloc_context_size, \
37 common_flags()->fast_unwind_on_malloc)
41 void InitializeInterceptors();
45 extern bool lsan_inited
;
46 extern bool lsan_init_is_running
;
48 extern "C" void __lsan_init();