Split out parts of scompare_loc_descriptor and emit_store_flag
[official-gcc.git] / libsanitizer / lsan / lsan.h
blob6d2d427b27d47e3ec9c5b027d2a67fb2a5e4cab0
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 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); \
29 } \
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)
39 namespace __lsan {
41 void InitializeInterceptors();
43 } // namespace __lsan
45 extern bool lsan_inited;
46 extern bool lsan_init_is_running;
48 extern "C" void __lsan_init();