gcc/
[official-gcc.git] / libsanitizer / lsan / lsan.h
blobee2fc02cf0824762c810cc62c0f32b4d3baf4a20
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.
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; \
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); \
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)
36 namespace __lsan {
38 void InitializeInterceptors();
40 } // namespace __lsan
42 extern bool lsan_inited;
43 extern bool lsan_init_is_running;
45 extern "C" void __lsan_init();