1 //===-- asan_stack.cc -----------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file is a part of AddressSanitizer, an address sanity checker. 11 // 12 // Code for ASan stack trace. 13 //===----------------------------------------------------------------------===// 14 #include "asan_internal.h" 15 #include "asan_stack.h" 16 #include "sanitizer_common/sanitizer_atomic.h" 17 18 namespace __asan { 19 20 static atomic_uint32_t malloc_context_size; 21 SetMallocContextSize(u32 size)22void SetMallocContextSize(u32 size) { 23 atomic_store(&malloc_context_size, size, memory_order_release); 24 } 25 GetMallocContextSize()26u32 GetMallocContextSize() { 27 return atomic_load(&malloc_context_size, memory_order_acquire); 28 } 29 30 } // namespace __asan 31 32 // ------------------ Interface -------------- {{{1 33 34 extern "C" { 35 SANITIZER_INTERFACE_ATTRIBUTE __sanitizer_print_stack_trace()36void __sanitizer_print_stack_trace() { 37 using namespace __asan; 38 PRINT_CURRENT_STACK(); 39 } 40 } // extern "C" 41