2012-06-04 21:50:10 +08:00
|
|
|
//===-- asan_stack.cc -----------------------------------------------------===//
|
2011-11-30 09:07:02 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is a part of AddressSanitizer, an address sanity checker.
|
|
|
|
//
|
|
|
|
// Code for ASan stack trace.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2013-01-31 21:46:14 +08:00
|
|
|
#include "asan_internal.h"
|
2012-08-28 22:11:57 +08:00
|
|
|
#include "asan_flags.h"
|
2011-11-30 09:07:02 +08:00
|
|
|
#include "asan_stack.h"
|
2012-06-04 19:20:17 +08:00
|
|
|
|
2011-11-30 09:07:02 +08:00
|
|
|
namespace __asan {
|
|
|
|
|
2012-12-08 06:01:28 +08:00
|
|
|
static bool MaybeCallAsanSymbolize(const void *pc, char *out_buffer,
|
|
|
|
int out_size) {
|
|
|
|
return (&__asan_symbolize) ? __asan_symbolize(pc, out_buffer, out_size)
|
|
|
|
: false;
|
|
|
|
}
|
|
|
|
|
2012-08-28 21:49:49 +08:00
|
|
|
void PrintStack(StackTrace *stack) {
|
|
|
|
stack->PrintStack(stack->trace, stack->size, flags()->symbolize,
|
2012-12-08 06:01:28 +08:00
|
|
|
flags()->strip_path_prefix, MaybeCallAsanSymbolize);
|
2012-08-28 21:49:49 +08:00
|
|
|
}
|
|
|
|
|
2011-11-30 09:07:02 +08:00
|
|
|
} // namespace __asan
|
2012-08-22 21:31:37 +08:00
|
|
|
|
|
|
|
// ------------------ Interface -------------- {{{1
|
|
|
|
|
2012-10-02 20:11:17 +08:00
|
|
|
// Provide default implementation of __asan_symbolize that does nothing
|
|
|
|
// and may be overriden by user if he wants to use his own symbolization.
|
|
|
|
// ASan on Windows has its own implementation of this.
|
2012-12-08 06:01:28 +08:00
|
|
|
#if !defined(_WIN32) && !SANITIZER_SUPPORTS_WEAK_HOOKS
|
2012-10-02 20:11:17 +08:00
|
|
|
SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE NOINLINE
|
|
|
|
bool __asan_symbolize(const void *pc, char *out_buffer, int out_size) {
|
|
|
|
return false;
|
2012-08-22 21:31:37 +08:00
|
|
|
}
|
2012-10-02 20:11:17 +08:00
|
|
|
#endif
|