forked from OSchip/llvm-project
[UBSan] Initialize symbolizer inside __ubsan::Init().
We used to initialize symbolizer lazily, but this doesn't work in various sandboxed environments. Instead, let's be consistent with the rest of sanitizers. llvm-svn: 214006
This commit is contained in:
parent
1440105338
commit
e87e5ce5d6
|
|
@ -63,8 +63,8 @@ Location __ubsan::getFunctionLocation(uptr Loc, const char **FName) {
|
|||
InitIfNecessary();
|
||||
|
||||
AddressInfo Info;
|
||||
if (!Symbolizer::GetOrInit()->SymbolizePC(Loc, &Info, 1) ||
|
||||
!Info.module || !*Info.module)
|
||||
if (!Symbolizer::Get()->SymbolizePC(Loc, &Info, 1) || !Info.module ||
|
||||
!*Info.module)
|
||||
return Location(Loc);
|
||||
|
||||
if (FName && Info.function)
|
||||
|
|
@ -148,7 +148,7 @@ static void renderText(const char *Message, const Diag::Arg *Args) {
|
|||
Printf("%s", A.String);
|
||||
break;
|
||||
case Diag::AK_Mangled: {
|
||||
Printf("'%s'", Symbolizer::GetOrInit()->Demangle(A.String));
|
||||
Printf("'%s'", Symbolizer::Get()->Demangle(A.String));
|
||||
break;
|
||||
}
|
||||
case Diag::AK_SInt:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_mutex.h"
|
||||
#include "sanitizer_common/sanitizer_symbolizer.h"
|
||||
|
||||
using namespace __ubsan;
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ void __ubsan::InitIfNecessary() {
|
|||
cf->print_summary = false;
|
||||
// Common flags may only be modified via UBSAN_OPTIONS.
|
||||
ParseCommonFlagsFromString(cf, GetEnv("UBSAN_OPTIONS"));
|
||||
Symbolizer::GetOrInit();
|
||||
}
|
||||
// Initialize UBSan-specific flags.
|
||||
InitializeFlags();
|
||||
|
|
|
|||
Loading…
Reference in New Issue