mirror of
https://github.com/intel/llvm.git
synced 2026-01-14 03:50:17 +08:00
[BOLT] Add a user friendly error reporting message
Summary: In case we fail to disassemble or to build the CFG for a function, print instructions on bug reporting. (cherry picked from FBD8549737)
This commit is contained in:
committed by
Maksim Panchenko
parent
221107c5fb
commit
35c09dc4dd
@@ -1052,3 +1052,22 @@ const Relocation *BinaryContext::getRelocationAt(uint64_t Address) {
|
||||
assert(Section && "cannot find section for address");
|
||||
return Section->getRelocationAt(Address - Section->getAddress());
|
||||
}
|
||||
|
||||
void BinaryContext::exitWithBugReport(StringRef Message,
|
||||
const BinaryFunction &Function) const {
|
||||
errs() << "=======================================\n";
|
||||
errs() << "BOLT is unable to proceed because it couldn't properly understand "
|
||||
"this function.\n";
|
||||
errs() << "If you are running the most recent version of BOLT, you may "
|
||||
"want to "
|
||||
"report this and paste this dump.\nPlease check that there is no "
|
||||
"sensitive contents being shared in this dump.\n";
|
||||
errs() << "\nOffending function: " << Function.getPrintName() << "\n\n";
|
||||
ScopedPrinter SP(errs());
|
||||
SP.printBinaryBlock("Function contents", *getFunctionData(Function));
|
||||
errs() << "\n";
|
||||
Function.dump();
|
||||
errs() << "ERROR: " << Message;
|
||||
errs() << "\n=======================================\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user