PR middle-end/84406
[official-gcc.git] / libsanitizer / asan / asan_stack.cc
blob973c5ce59eff13c0293799e3c6d883d1dd7f4fb0
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"
16 namespace __asan {
18 static atomic_uint32_t malloc_context_size;
20 void SetMallocContextSize(u32 size) {
21 atomic_store(&malloc_context_size, size, memory_order_release);
24 u32 GetMallocContextSize() {
25 return atomic_load(&malloc_context_size, memory_order_acquire);
28 } // namespace __asan
30 // ------------------ Interface -------------- {{{1
32 extern "C" {
33 SANITIZER_INTERFACE_ATTRIBUTE
34 void __sanitizer_print_stack_trace() {
35 using namespace __asan;
36 PRINT_CURRENT_STACK();
38 } // extern "C"