[BOLT][NFC] Extend debug logging in analyzeJumpTable
Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D131918
This commit is contained in:
parent
eca990702d
commit
556efdba85
|
@ -538,8 +538,12 @@ bool BinaryContext::analyzeJumpTable(
|
||||||
if (NextJTAddress)
|
if (NextJTAddress)
|
||||||
UpperBound = std::min(NextJTAddress, UpperBound);
|
UpperBound = std::min(NextJTAddress, UpperBound);
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: analyzeJumpTable in " << BF.getPrintName()
|
LLVM_DEBUG({
|
||||||
<< '\n');
|
using JTT = JumpTable::JumpTableType;
|
||||||
|
dbgs() << formatv("BOLT-DEBUG: analyzeJumpTable @{0:x} in {1}, JTT={2}\n",
|
||||||
|
Address, BF.getPrintName(),
|
||||||
|
Type == JTT::JTT_PIC ? "PIC" : "Normal");
|
||||||
|
});
|
||||||
const uint64_t EntrySize = getJumpTableEntrySize(Type);
|
const uint64_t EntrySize = getJumpTableEntrySize(Type);
|
||||||
for (uint64_t EntryAddress = Address; EntryAddress <= UpperBound - EntrySize;
|
for (uint64_t EntryAddress = Address; EntryAddress <= UpperBound - EntrySize;
|
||||||
EntryAddress += EntrySize) {
|
EntryAddress += EntrySize) {
|
||||||
|
@ -570,7 +574,7 @@ bool BinaryContext::analyzeJumpTable(
|
||||||
if (Value == BF.getAddress() + BF.getSize()) {
|
if (Value == BF.getAddress() + BF.getSize()) {
|
||||||
addEntryAddress(Value);
|
addEntryAddress(Value);
|
||||||
HasUnreachable = true;
|
HasUnreachable = true;
|
||||||
LLVM_DEBUG(dbgs() << "OK: __builtin_unreachable\n");
|
LLVM_DEBUG(dbgs() << formatv("OK: {0:x} __builtin_unreachable\n", Value));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,12 +589,12 @@ bool BinaryContext::analyzeJumpTable(
|
||||||
if (TargetBF) {
|
if (TargetBF) {
|
||||||
dbgs() << " ! function containing this address: "
|
dbgs() << " ! function containing this address: "
|
||||||
<< TargetBF->getPrintName() << '\n';
|
<< TargetBF->getPrintName() << '\n';
|
||||||
if (TargetBF->isFragment())
|
if (TargetBF->isFragment()) {
|
||||||
dbgs() << " ! is a fragment\n";
|
dbgs() << " ! is a fragment";
|
||||||
for (BinaryFunction *TargetParent : TargetBF->ParentFragments)
|
for (BinaryFunction *Parent : TargetBF->ParentFragments)
|
||||||
dbgs() << " ! its parent is "
|
dbgs() << ", parent: " << Parent->getPrintName();
|
||||||
<< (TargetParent ? TargetParent->getPrintName() : "(none)")
|
dbgs() << '\n';
|
||||||
<< '\n';
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Value == BF.getAddress())
|
if (Value == BF.getAddress())
|
||||||
|
@ -602,11 +606,12 @@ bool BinaryContext::analyzeJumpTable(
|
||||||
// Check there's an instruction at this offset.
|
// Check there's an instruction at this offset.
|
||||||
if (TargetBF->getState() == BinaryFunction::State::Disassembled &&
|
if (TargetBF->getState() == BinaryFunction::State::Disassembled &&
|
||||||
!TargetBF->getInstructionAtOffset(Value - TargetBF->getAddress())) {
|
!TargetBF->getInstructionAtOffset(Value - TargetBF->getAddress())) {
|
||||||
LLVM_DEBUG(dbgs() << "FAIL: no instruction at this offset\n");
|
LLVM_DEBUG(dbgs() << formatv("FAIL: no instruction at {0:x}\n", Value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++NumRealEntries;
|
++NumRealEntries;
|
||||||
|
LLVM_DEBUG(dbgs() << formatv("OK: {0:x} real entry\n", Value));
|
||||||
|
|
||||||
if (TargetBF != &BF)
|
if (TargetBF != &BF)
|
||||||
BF.setHasIndirectTargetToSplitFragment(true);
|
BF.setHasIndirectTargetToSplitFragment(true);
|
||||||
|
|
Loading…
Reference in New Issue