Ensure consumed errors are printed somewhere

This commit is contained in:
Ivan Krysak
2025-09-29 15:17:33 +03:00
parent 25538385c8
commit df681aa573
4 changed files with 14 additions and 3 deletions
+1
View File
@@ -769,6 +769,7 @@ IT::translate(PTCInstruction *Instr, MetaAddress PC, MetaAddress NextPC) {
// Check if there was an error while translating the instruction
if (!Result) {
// TODO: log
llvm::consumeError(Result.takeError());
return Abort;
}
@@ -225,6 +225,7 @@ Error ELFImporter<T, HasAddend>::import(const ImporterOptions &Options) {
auto MaybeSectionName = TheELF.getSectionName(SectionHeader);
if (auto Error = MaybeSectionName.takeError()) {
revng_log(ELFImporterLog, "Cannot access section name: " << Error);
consumeError(std::move(Error));
} else {
SectionName = *MaybeSectionName;
@@ -1226,6 +1227,7 @@ void ELFImporter<T, HasAddend>::registerRelocations(Elf_Rel_Array Relocations,
auto MaybeName = Symbol.getName(Dynstr.extractString());
if (auto Error = MaybeName.takeError()) {
revng_log(ELFImporterLog, "Cannot access symbol name: " << Error);
consumeError(std::move(Error));
} else {
SymbolName = *MaybeName;
@@ -1214,7 +1214,9 @@ void DwarfImporter::import(StringRef FileName, const ImporterOptions &Options) {
return true;
} else {
llvm::consumeError(NameOrErr.takeError());
llvm::Error Error = NameOrErr.takeError();
revng_log(DILogger, "Cannot access section name: " << Error);
llvm::consumeError(std::move(Error));
continue;
}
}
@@ -1333,15 +1335,19 @@ computeEquivalentSymbols(const llvm::object::ObjectFile &ELF) {
auto MaybeFlags = Symbol.getFlags();
if (auto Error = MaybeType.takeError()) {
revng_log(DILogger, "Cannot access symbol type: " << Error);
consumeError(std::move(Error));
continue;
} else if (auto Error = MaybeAddress.takeError()) {
revng_log(DILogger, "Cannot access symbol address: " << Error);
consumeError(std::move(Error));
continue;
} else if (auto Error = MaybeName.takeError()) {
revng_log(DILogger, "Cannot access symbol name: " << Error);
consumeError(std::move(Error));
continue;
} else if (auto Error = MaybeFlags.takeError()) {
revng_log(DILogger, "Cannot access symbol flags: " << Error);
consumeError(std::move(Error));
continue;
}
+4 -2
View File
@@ -256,7 +256,9 @@ public:
// error condition.
// TODO: emit a diagnostic message for the user.
consumeError(MaybeDebugStream.takeError());
llvm::Error Error = MaybeDebugStream.takeError();
revng_log(Log, "Error reading from the PDB stream: " << Error);
consumeError(std::move(Error));
}
return Error::success();
@@ -323,6 +325,7 @@ bool PDBImporter::loadDataFromPDB(StringRef PDBFileName) {
auto MaybePDBInfoStream = ThePDBFile->getPDBInfoStream();
if (auto Error = MaybePDBInfoStream.takeError()) {
// TODO: emit a diagnostic message for the user.
revng_log(Log, "Error reading from the PDB stream: " << Error);
consumeError(std::move(Error));
// TODO: is it correct to ignore this error?
return true;
@@ -330,7 +333,6 @@ bool PDBImporter::loadDataFromPDB(StringRef PDBFileName) {
codeview::GUID GUIDFromPDBFile = MaybePDBInfoStream->getGuid();
if (ExpectedGUID != GUIDFromPDBFile) {
// TODO: emit a diagnostic message for the user.
revng_log(Log, "Signatures from exe and PDB file mismatch");
return false;
}