2013-10-26 07:03:29 +08:00
|
|
|
//===-- sanitizer_symbolizer_libcdep.cc -----------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// 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);
|
2013-10-29 00:31:39 +08:00
|
|
|
if (!platform_symbolizer)
|
|
|
|
return Disable();
|
2013-10-31 01:05:37 +08:00
|
|
|
symbolizer_ = platform_symbolizer;
|
2013-10-26 07:03:29 +08:00
|
|
|
return platform_symbolizer;
|
|
|
|
}
|
|
|
|
|
|
|
|
Symbolizer *Symbolizer::Init(const char *path_to_external) {
|
2013-10-31 01:05:37 +08:00
|
|
|
CHECK_EQ(0, symbolizer_);
|
2013-10-26 07:03:29 +08:00
|
|
|
return CreateAndStore(path_to_external);
|
|
|
|
}
|
|
|
|
|
|
|
|
Symbolizer *Symbolizer::GetOrInit() {
|
2013-10-31 01:05:37 +08:00
|
|
|
SpinMutexLock l(&init_mu_);
|
|
|
|
if (symbolizer_ == 0)
|
|
|
|
return CreateAndStore(0);
|
|
|
|
return symbolizer_;
|
2013-10-26 07:03:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace __sanitizer
|