2012-11-12 16:53:47 +01:00
|
|
|
//===-- asan_stack.cc -----------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// 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-02-13 11:46:01 +01:00
|
|
|
#include "asan_internal.h"
|
2012-11-12 16:53:47 +01:00
|
|
|
#include "asan_stack.h"
|
2015-10-21 09:32:45 +02:00
|
|
|
#include "sanitizer_common/sanitizer_atomic.h"
|
|
|
|
|
|
|
|
namespace __asan {
|
|
|
|
|
|
|
|
static atomic_uint32_t malloc_context_size;
|
|
|
|
|
|
|
|
void SetMallocContextSize(u32 size) {
|
|
|
|
atomic_store(&malloc_context_size, size, memory_order_release);
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 GetMallocContextSize() {
|
|
|
|
return atomic_load(&malloc_context_size, memory_order_acquire);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace __asan
|
2012-11-12 16:53:47 +01:00
|
|
|
|
|
|
|
// ------------------ Interface -------------- {{{1
|
|
|
|
|
2013-12-05 11:28:59 +01:00
|
|
|
extern "C" {
|
|
|
|
SANITIZER_INTERFACE_ATTRIBUTE
|
|
|
|
void __sanitizer_print_stack_trace() {
|
|
|
|
using namespace __asan;
|
|
|
|
PRINT_CURRENT_STACK();
|
|
|
|
}
|
|
|
|
} // extern "C"
|