1 //===-- asan_stack.cc -----------------------------------------------------===// 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 AddressSanitizer, an address sanity checker. 9 // 10 // Code for ASan stack trace. 11 //===----------------------------------------------------------------------===// 12 #include "asan_internal.h" 13 #include "asan_stack.h" 14 #include "sanitizer_common/sanitizer_atomic.h" 15 16 namespace __asan { 17 18 static atomic_uint32_t malloc_context_size; 19 SetMallocContextSize(u32 size)20void SetMallocContextSize(u32 size) { 21 atomic_store(&malloc_context_size, size, memory_order_release); 22 } 23 GetMallocContextSize()24u32 GetMallocContextSize() { 25 return atomic_load(&malloc_context_size, memory_order_acquire); 26 } 27 28 } // namespace __asan 29 30 // ------------------ Interface -------------- {{{1 31 32 extern "C" { 33 SANITIZER_INTERFACE_ATTRIBUTE __sanitizer_print_stack_trace()34void __sanitizer_print_stack_trace() { 35 using namespace __asan; 36 PRINT_CURRENT_STACK(); 37 } 38 } // extern "C" 39