Skip to content

Commit fc77200

Browse files
Added TotalFragmentWithoutAddendsSize to make debugging easier.
1 parent 5ad197c commit fc77200

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
@@ -3123,6 +3123,13 @@ Error MCCASBuilder::buildFragments() {
31233123
ArrayRef<MachO::any_relocation_info> RelocationBuffer;
31243124
MCDataFragmentMerger Merger(*this, &Sec);
31253125
uint64_t RelocationBufferIndex = 0;
3126+
// This is here for debugging purposes only, it is useful to know what the
3127+
// total size of all fragments without a section have been converted to
3128+
// CASObjects, one can use a conditional breakpoint to find the Fragment
3129+
// which might have a bug.
3130+
#ifndef NDEBUG
3131+
uint64_t TotalFragmentWithoutAddendsSize = 0;
3132+
#endif
31263133
for (const MCFragment &F : Sec) {
31273134
auto Relocs = RelMap.find(&F);
31283135
if (RelocLocation == Atom) {
@@ -3166,6 +3173,9 @@ Error MCCASBuilder::buildFragments() {
31663173
partitionFragment(Asm, Addends, FinalFragmentContents, RelocationBuffer,
31673174
F, RelocationBufferIndex,
31683175
ObjectWriter.Target.isLittleEndian());
3176+
#ifndef NDEBUG
3177+
TotalFragmentWithoutAddendsSize += FinalFragmentContents.size();
3178+
#endif
31693179

31703180
if (auto E = Merger.tryMerge(F, Size, FinalFragmentContents))
31713181
return E;
@@ -3190,6 +3200,9 @@ Error MCCASBuilder::buildFragments() {
31903200

31913201
if (auto E = finalizeSection())
31923202
return E;
3203+
#ifndef NDEBUG
3204+
TotalFragmentWithoutAddendsSize = 0;
3205+
#endif
31933206
}
31943207
return finalizeGroup();
31953208
}

0 commit comments

Comments
 (0)