1 //===-- asan_stack.cc -----------------------------------------------------===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of AddressSanitizer, an address sanity checker.
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"
19 static bool MaybeCallAsanSymbolize(const void *pc
, char *out_buffer
,
21 return (&__asan_symbolize
) ? __asan_symbolize(pc
, out_buffer
, out_size
)
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
);
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
) {
48 SANITIZER_INTERFACE_ATTRIBUTE
49 void __sanitizer_print_stack_trace() {
50 using namespace __asan
;
51 PRINT_CURRENT_STACK();