@@ -3120,6 +3120,13 @@ Error MCCASBuilder::buildFragments() {
3120
3120
ArrayRef<MachO::any_relocation_info> RelocationBuffer;
3121
3121
MCDataFragmentMerger Merger (*this , &Sec);
3122
3122
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
3123
3130
for (const MCFragment &F : Sec) {
3124
3131
auto Relocs = RelMap.find (&F);
3125
3132
if (RelocLocation == Atom) {
@@ -3163,6 +3170,9 @@ Error MCCASBuilder::buildFragments() {
3163
3170
partitionFragment (Asm, Addends, FinalFragmentContents, RelocationBuffer,
3164
3171
F, RelocationBufferIndex,
3165
3172
ObjectWriter.Target .isLittleEndian ());
3173
+ #ifndef NDEBUG
3174
+ TotalFragmentWithoutAddendsSize += FinalFragmentContents.size ();
3175
+ #endif
3166
3176
3167
3177
if (auto E = Merger.tryMerge (F, Size, FinalFragmentContents))
3168
3178
return E;
@@ -3187,6 +3197,9 @@ Error MCCASBuilder::buildFragments() {
3187
3197
3188
3198
if (auto E = finalizeSection ())
3189
3199
return E;
3200
+ #ifndef NDEBUG
3201
+ TotalFragmentWithoutAddendsSize = 0 ;
3202
+ #endif
3190
3203
}
3191
3204
return finalizeGroup ();
3192
3205
}
0 commit comments