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