@@ -3123,6 +3123,13 @@ Error MCCASBuilder::buildFragments() {
3123
3123
ArrayRef<MachO::any_relocation_info> RelocationBuffer;
3124
3124
MCDataFragmentMerger Merger (*this , &Sec);
3125
3125
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
3126
3133
for (const MCFragment &F : Sec) {
3127
3134
auto Relocs = RelMap.find (&F);
3128
3135
if (RelocLocation == Atom) {
@@ -3166,6 +3173,9 @@ Error MCCASBuilder::buildFragments() {
3166
3173
partitionFragment (Asm, Addends, FinalFragmentContents, RelocationBuffer,
3167
3174
F, RelocationBufferIndex,
3168
3175
ObjectWriter.Target .isLittleEndian ());
3176
+ #ifndef NDEBUG
3177
+ TotalFragmentWithoutAddendsSize += FinalFragmentContents.size ();
3178
+ #endif
3169
3179
3170
3180
if (auto E = Merger.tryMerge (F, Size, FinalFragmentContents))
3171
3181
return E;
@@ -3190,6 +3200,9 @@ Error MCCASBuilder::buildFragments() {
3190
3200
3191
3201
if (auto E = finalizeSection ())
3192
3202
return E;
3203
+ #ifndef NDEBUG
3204
+ TotalFragmentWithoutAddendsSize = 0 ;
3205
+ #endif
3193
3206
}
3194
3207
return finalizeGroup ();
3195
3208
}
0 commit comments