Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yingcong-wu committed Oct 24, 2024
1 parent 7384e2d commit 39c04f8
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions source/loader/layers/sanitizer/linux/symbolizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,20 @@

namespace ur_sanitizer_layer {

llvm::symbolize::LLVMSymbolizer *GetSymbolizer() {
static llvm::symbolize::LLVMSymbolizer Symbolizer;
return &Symbolizer;
llvm::symbolize::LLVMSymbolizer *GetSymbolizer(bool destruct = false) {
static auto *Instance = new llvm::symbolize::LLVMSymbolizer{};
if (destruct) {
Instance = nullptr;
delete Instance;
}
return Instance;
}

// Let's destruct the symbolizer at the very end of exit process, at least
// should be after the destructors of the SanitizerLayer since we may print
// some symbolized information in the SanitizerLayer destructor.
__attribute__((destructor(101))) void DestructSymbolizer() {
GetSymbolizer(true);
}

llvm::symbolize::PrinterConfig GetPrinterConfig() {
Expand Down

0 comments on commit 39c04f8

Please sign in to comment.