lsan.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include "sanitizer_common/sanitizer_flags.h"
  13. #include "sanitizer_common/sanitizer_stacktrace.h"
  14. #define GET_STACK_TRACE(max_size, fast) \
  15. BufferedStackTrace stack; \
  16. { \
  17. uptr stack_top = 0, stack_bottom = 0; \
  18. ThreadContext *t; \
  19. if (fast && (t = CurrentThreadContext())) { \
  20. stack_top = t->stack_end(); \
  21. stack_bottom = t->stack_begin(); \
  22. } \
  23. stack.Unwind(max_size, StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \
  24. /* context */ 0, stack_top, stack_bottom, fast); \
  25. }
  26. #define GET_STACK_TRACE_FATAL \
  27. GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
  28. #define GET_STACK_TRACE_MALLOC \
  29. GET_STACK_TRACE(__sanitizer::common_flags()->malloc_context_size, \
  30. common_flags()->fast_unwind_on_malloc)
  31. namespace __lsan {
  32. void InitializeInterceptors();
  33. } // namespace __lsan
  34. extern bool lsan_inited;
  35. extern bool lsan_init_is_running;
  36. extern "C" void __lsan_init();