[PATCH] D131918: [BOLT][NFC] Extend debug logging in analyzeJumpTable
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 15 13:31:29 PDT 2022
Amir created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131918
Files:
bolt/lib/Core/BinaryContext.cpp
Index: bolt/lib/Core/BinaryContext.cpp
===================================================================
--- bolt/lib/Core/BinaryContext.cpp
+++ bolt/lib/Core/BinaryContext.cpp
@@ -538,8 +538,12 @@
if (NextJTAddress)
UpperBound = std::min(NextJTAddress, UpperBound);
- LLVM_DEBUG(dbgs() << "BOLT-DEBUG: analyzeJumpTable in " << BF.getPrintName()
- << '\n');
+ LLVM_DEBUG({
+ using namespace JumpTable::JumpTableType;
+ dbgs() << formatv("BOLT-DEBUG: analyzeJumpTable @{0:x} in {1}, JTT={2}\n",
+ Address, BF.getPrintName(),
+ Type == JTT_PIC ? "PIC" : "Normal");
+ });
const uint64_t EntrySize = getJumpTableEntrySize(Type);
for (uint64_t EntryAddress = Address; EntryAddress <= UpperBound - EntrySize;
EntryAddress += EntrySize) {
@@ -570,7 +574,7 @@
if (Value == BF.getAddress() + BF.getSize()) {
addEntryAddress(Value);
HasUnreachable = true;
- LLVM_DEBUG(dbgs() << "OK: __builtin_unreachable\n");
+ LLVM_DEBUG(dbgs() << formatv("OK: {0:x} __builtin_unreachable\n", Value));
continue;
}
@@ -585,12 +589,12 @@
if (TargetBF) {
dbgs() << " ! function containing this address: "
<< TargetBF->getPrintName() << '\n';
- if (TargetBF->isFragment())
- dbgs() << " ! is a fragment\n";
- for (BinaryFunction *TargetParent : TargetBF->ParentFragments)
- dbgs() << " ! its parent is "
- << (TargetParent ? TargetParent->getPrintName() : "(none)")
- << '\n';
+ if (TargetBF->isFragment()) {
+ dbgs() << " ! is a fragment";
+ for (BinaryFunction *Parent : TargetBF->ParentFragments)
+ dbgs() << ", parent: " << Parent->getPrintName();
+ dbgs() << '\n';
+ }
}
}
if (Value == BF.getAddress())
@@ -602,11 +606,12 @@
// Check there's an instruction at this offset.
if (TargetBF->getState() == BinaryFunction::State::Disassembled &&
!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;
}
++NumRealEntries;
+ LLVM_DEBUG(dbgs() << formatv("OK: {0:x} real entry\n", Value));
if (TargetBF != &BF)
BF.setHasIndirectTargetToSplitFragment(true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131918.452792.patch
Type: text/x-patch
Size: 2531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220815/3b973ce8/attachment.bin>
More information about the llvm-commits
mailing list