gcc/libsanitizer/sanitizer_common/sanitizer_symbolizer_libcdep.cc
Kostya Serebryany df77f0e4ec libsanitizer merge from upstream r196090
From-SVN: r205695
2013-12-05 09:18:38 +00:00

38 lines
1.1 KiB
C++

//===-- sanitizer_symbolizer_libcdep.cc -----------------------------------===//
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is shared between AddressSanitizer and ThreadSanitizer
// run-time libraries.
//===----------------------------------------------------------------------===//
#include "sanitizer_internal_defs.h"
#include "sanitizer_symbolizer.h"
namespace __sanitizer {
Symbolizer *Symbolizer::CreateAndStore(const char *path_to_external) {
Symbolizer *platform_symbolizer = PlatformInit(path_to_external);
if (!platform_symbolizer)
return Disable();
symbolizer_ = platform_symbolizer;
return platform_symbolizer;
}
Symbolizer *Symbolizer::Init(const char *path_to_external) {
CHECK_EQ(0, symbolizer_);
return CreateAndStore(path_to_external);
}
Symbolizer *Symbolizer::GetOrInit() {
SpinMutexLock l(&init_mu_);
if (symbolizer_ == 0)
return CreateAndStore(0);
return symbolizer_;
}
} // namespace __sanitizer