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 16 namespace __asan { 17 18 static bool MaybeCallAsanSymbolize(const void *pc, char *out_buffer, 19 int out_size) { 20 return (&__asan_symbolize) ? __asan_symbolize(pc, out_buffer, out_size) 21 : false; 22 } 23 24 void PrintStack(StackTrace *stack) { 25 stack->PrintStack(stack->trace, stack->size, flags()->symbolize, 26 flags()->strip_path_prefix, MaybeCallAsanSymbolize); 27 } 28 29 } // namespace __asan 30 31 // ------------------ Interface -------------- {{{1 32 33 // Provide default implementation of __asan_symbolize that does nothing 34 // and may be overriden by user if he wants to use his own symbolization. 35 // ASan on Windows has its own implementation of this. 36 #if !defined(_WIN32) && !SANITIZER_SUPPORTS_WEAK_HOOKS 37 SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE NOINLINE 38 bool __asan_symbolize(const void *pc, char *out_buffer, int out_size) { 39 return false; 40 } 41 #endif 42