[compiler-rt] de4c038 - [sanitizer] adapt for 75f1f158812dabc03e70697b6b9c272230bce63d
Krasimir Georgiev via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 01:19:54 PDT 2023
Author: Krasimir Georgiev
Date: 2023-04-14T08:18:43Z
New Revision: de4c038c7ba2c6a8d529cb094f1a7c3deaae9b75
URL: https://github.com/llvm/llvm-project/commit/de4c038c7ba2c6a8d529cb094f1a7c3deaae9b75
DIFF: https://github.com/llvm/llvm-project/commit/de4c038c7ba2c6a8d529cb094f1a7c3deaae9b75.diff
LOG: [sanitizer] adapt for 75f1f158812dabc03e70697b6b9c272230bce63d
No functional changes intended.
Added:
Modified:
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp b/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
index bca12d42f90a..2bc0444050f8 100644
--- a/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
@@ -41,6 +41,16 @@ static llvm::symbolize::PrinterConfig getDefaultPrinterConfig() {
return Config;
}
+static llvm::symbolize::ErrorHandler symbolize_error_handler(
+ llvm::raw_string_ostream &OS) {
+ return
+ [&](const llvm::ErrorInfoBase &ErrorInfo, llvm::StringRef ErrorBanner) {
+ OS << ErrorBanner;
+ ErrorInfo.log(OS);
+ OS << '\n';
+ };
+}
+
namespace __sanitizer {
int internal_snprintf(char *buffer, uintptr_t length, const char *format,
...);
@@ -57,8 +67,8 @@ bool __sanitizer_symbolize_code(const char *ModuleName, uint64_t ModuleOffset,
llvm::raw_string_ostream OS(Result);
llvm::symbolize::PrinterConfig Config = getDefaultPrinterConfig();
llvm::symbolize::Request Request{ModuleName, ModuleOffset};
- auto Printer =
- std::make_unique<llvm::symbolize::LLVMPrinter>(OS, OS, Config);
+ auto Printer = std::make_unique<llvm::symbolize::LLVMPrinter>(
+ OS, symbolize_error_handler(OS), Config);
// TODO: it is neccessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
@@ -86,8 +96,8 @@ bool __sanitizer_symbolize_data(const char *ModuleName, uint64_t ModuleOffset,
llvm::symbolize::PrinterConfig Config = getDefaultPrinterConfig();
llvm::raw_string_ostream OS(Result);
llvm::symbolize::Request Request{ModuleName, ModuleOffset};
- auto Printer =
- std::make_unique<llvm::symbolize::LLVMPrinter>(OS, OS, Config);
+ auto Printer = std::make_unique<llvm::symbolize::LLVMPrinter>(
+ OS, symbolize_error_handler(OS), Config);
// TODO: it is neccessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
More information about the llvm-commits
mailing list