Skip to content

Commit 1785ea3

Browse files
Added TotalFragmentWithoutAddendsSize to make debugging easier.
1 parent 9a11cc1 commit 1785ea3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/lib/MCCAS/MCCASObjectV1.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,6 +3120,13 @@ Error MCCASBuilder::buildFragments() {
31203120
ArrayRef<MachO::any_relocation_info> RelocationBuffer;
31213121
MCDataFragmentMerger Merger(*this, &Sec);
31223122
uint64_t RelocationBufferIndex = 0;
3123+
// This is here for debugging purposes only, it is useful to know what the
3124+
// total size of all fragments without a section have been converted to
3125+
// CASObjects, one can use a conditional breakpoint to find the Fragment
3126+
// which might have a bug.
3127+
#ifndef NDEBUG
3128+
uint64_t TotalFragmentWithoutAddendsSize = 0;
3129+
#endif
31233130
for (const MCFragment &F : Sec) {
31243131
auto Relocs = RelMap.find(&F);
31253132
if (RelocLocation == Atom) {
@@ -3163,6 +3170,9 @@ Error MCCASBuilder::buildFragments() {
31633170
partitionFragment(Asm, Addends, FinalFragmentContents, RelocationBuffer,
31643171
F, RelocationBufferIndex,
31653172
ObjectWriter.Target.isLittleEndian());
3173+
#ifndef NDEBUG
3174+
TotalFragmentWithoutAddendsSize += FinalFragmentContents.size();
3175+
#endif
31663176

31673177
if (auto E = Merger.tryMerge(F, Size, FinalFragmentContents))
31683178
return E;
@@ -3187,6 +3197,9 @@ Error MCCASBuilder::buildFragments() {
31873197

31883198
if (auto E = finalizeSection())
31893199
return E;
3200+
#ifndef NDEBUG
3201+
TotalFragmentWithoutAddendsSize = 0;
3202+
#endif
31903203
}
31913204
return finalizeGroup();
31923205
}

0 commit comments

Comments
 (0)