]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/asan/asan_stack.cc
Merge ^/head r313301 through r313643.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / asan / asan_stack.cc
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
22 void SetMallocContextSize(u32 size) {
23   atomic_store(&malloc_context_size, size, memory_order_release);
24 }
25
26 u32 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
36 void __sanitizer_print_stack_trace() {
37   using namespace __asan;
38   PRINT_CURRENT_STACK();
39 }
40 }  // extern "C"