* include/bits/allocator.h (operator==, operator!=): Add exception
[official-gcc.git] / libsanitizer / asan / asan_stack.cc
blob24cccbd196e33e9e6481e8817dfc37a947e72191
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_flags.h"
14 #include "asan_stack.h"
15 #include "sanitizer_common/sanitizer_flags.h"
17 namespace __asan {
19 static bool MaybeCallAsanSymbolize(const void *pc, char *out_buffer,
20 int out_size) {
21 return (&__asan_symbolize) ? __asan_symbolize(pc, out_buffer, out_size)
22 : false;
25 void PrintStack(const uptr *trace, uptr size) {
26 StackTrace::PrintStack(trace, size, MaybeCallAsanSymbolize);
29 void PrintStack(StackTrace *stack) {
30 PrintStack(stack->trace, stack->size);
33 } // namespace __asan
35 // ------------------ Interface -------------- {{{1
37 // Provide default implementation of __asan_symbolize that does nothing
38 // and may be overriden by user if he wants to use his own symbolization.
39 // ASan on Windows has its own implementation of this.
40 #if !SANITIZER_WINDOWS && !SANITIZER_SUPPORTS_WEAK_HOOKS
41 SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE NOINLINE
42 bool __asan_symbolize(const void *pc, char *out_buffer, int out_size) {
43 return false;
45 #endif
47 extern "C" {
48 SANITIZER_INTERFACE_ATTRIBUTE
49 void __sanitizer_print_stack_trace() {
50 using namespace __asan;
51 PRINT_CURRENT_STACK();
53 } // extern "C"