[BOLT][PR] In some cases DB could be nullptr

Summary:
When processing binary with -debug mode in some cases, BD could be nullptr. It will be better to fail later on assert than here with segfault.
Closes https://github.com/facebookincubator/BOLT/pull/18
GitHub Author: Alexander Gryanko <xpahos@gmail.com>

(cherry picked from FBD8650719)
This commit is contained in:
Facebook Github Bot 2018-06-26 17:02:00 -07:00 committed by Maksim Panchenko
parent 72ecd12f2f
commit 07353e9590
1 changed files with 2 additions and 1 deletions

View File

@ -1017,8 +1017,9 @@ void BinaryFunction::disassemble(ArrayRef<uint8_t> FunctionData) {
auto *TargetSymbol =
BC.getOrCreateGlobalSymbol(TargetAddress, 0, 0, "DATAat");
DEBUG(if (opts::Verbosity >= 2) {
auto SectionName = BD ? BD->getSectionName() : "<unknown>";
dbgs() << "Created DATAat sym: " << TargetSymbol->getName()
<< " in section " << BD->getSectionName() << "\n";
<< " in section " << SectionName << "\n";
});
return TargetSymbol;
};