1 //=-- lsan.h --------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of LeakSanitizer.
11 // Private header for standalone LSan RTL.
13 //===----------------------------------------------------------------------===//
15 #include "sanitizer_common/sanitizer_flags.h"
16 #include "sanitizer_common/sanitizer_stacktrace.h"
18 #define GET_STACK_TRACE(max_size, fast) \
19 BufferedStackTrace stack; \
21 uptr stack_top = 0, stack_bottom = 0; \
23 if (fast && (t = CurrentThreadContext())) { \
24 stack_top = t->stack_end(); \
25 stack_bottom = t->stack_begin(); \
27 stack.Unwind(max_size, StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \
28 /* context */ 0, stack_top, stack_bottom, fast); \
31 #define GET_STACK_TRACE_FATAL \
32 GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
34 #define GET_STACK_TRACE_MALLOC \
35 GET_STACK_TRACE(__sanitizer::common_flags()->malloc_context_size, \
36 common_flags()->fast_unwind_on_malloc)
40 void InitializeInterceptors();
44 extern bool lsan_inited;
45 extern bool lsan_init_is_running;
47 extern "C" void __lsan_init();