1 //===-- sanitizer_symbolizer.cc -------------------------------------------===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is shared between AddressSanitizer and ThreadSanitizer
10 //===----------------------------------------------------------------------===//
12 #include "sanitizer_platform.h"
13 #include "sanitizer_internal_defs.h"
14 #include "sanitizer_placement_new.h"
15 #include "sanitizer_symbolizer.h"
17 namespace __sanitizer
{
19 Symbolizer
*Symbolizer::symbolizer_
;
20 StaticSpinMutex
Symbolizer::init_mu_
;
21 LowLevelAllocator
Symbolizer::symbolizer_allocator_
;
23 Symbolizer
*Symbolizer::Disable() {
24 CHECK_EQ(0, symbolizer_
);
25 // Initialize a dummy symbolizer.
26 symbolizer_
= new(symbolizer_allocator_
) Symbolizer
;
30 void Symbolizer::AddHooks(Symbolizer::StartSymbolizationHook start_hook
,
31 Symbolizer::EndSymbolizationHook end_hook
) {
32 CHECK(start_hook_
== 0 && end_hook_
== 0);
33 start_hook_
= start_hook
;
37 Symbolizer::Symbolizer() : start_hook_(0), end_hook_(0) {}
39 Symbolizer::SymbolizerScope::SymbolizerScope(const Symbolizer
*sym
)
41 if (sym_
->start_hook_
)
45 Symbolizer::SymbolizerScope::~SymbolizerScope() {
50 } // namespace __sanitizer