Skip to content

Commit

Permalink
[symbolizer] API evolution for ErrorHandler
Browse files Browse the repository at this point in the history
Change-Id: I438358dc79195444aed0658942b23869eda8117e
  • Loading branch information
ronlieb committed Apr 23, 2023
1 parent 4abec2f commit 13dfb8f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/comgr/src/comgr-symbolizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,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';
};
}

Symbolizer::Symbolizer(std::unique_ptr<ObjectFile> &&CodeObject,
PrintSymbolCallback PrintSymbol)
: CodeObject(std::move(CodeObject)), PrintSymbol(PrintSymbol) {}
Expand Down Expand Up @@ -93,7 +103,7 @@ amd_comgr_status_t Symbolizer::symbolize(uint64_t Address, bool IsCode,
llvm::raw_string_ostream OS(Result);
llvm::symbolize::PrinterConfig Config = getDefaultPrinterConfig();
llvm::symbolize::Request Request{"", Address};
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);

if (IsCode) {
auto ResOrErr = SymbolizerImpl.symbolizeInlinedCode(
Expand Down

0 comments on commit 13dfb8f

Please sign in to comment.