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