2013-02-04 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / libsanitizer / asan / asan_stack.cc
blob9b6a28e8082ef7cf6885e7dd425b3205cb288df7
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_flags.h"
13 #include "asan_stack.h"
14 #include "sanitizer/asan_interface.h"
16 namespace __asan {
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;
24 void PrintStack(StackTrace *stack) {
25 stack->PrintStack(stack->trace, stack->size, flags()->symbolize,
26 flags()->strip_path_prefix, MaybeCallAsanSymbolize);
29 } // namespace __asan
31 // ------------------ Interface -------------- {{{1
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;
41 #endif