@@ -405,17 +405,19 @@ - (NSArray *)loadMethodsAtAddress:(uint64_t)address extendedMethodTypesCursor:(C
405
405
406
406
struct cd_objc2_list_header listHeader;
407
407
408
- // See getEntsize() from http://www.opensource.apple.com/source/objc4/objc4-532.2/runtime/objc-runtime-new.h
409
- listHeader.entsize = [cursor readInt32 ] & ~(uint32_t )3 ;
410
- listHeader.count = [cursor readInt32 ];
411
- NSParameterAssert (listHeader.entsize == 3 * [self .machOFile ptrSize ]);
412
-
408
+ // See https://opensource.apple.com/source/objc4/objc4-787.1/runtime/objc-runtime-new.h
409
+ uint32_t value = [cursor readInt32 ];
410
+ listHeader.entsize = value & ~METHOD_LIST_T_ENTSIZE_MASK;
411
+ bool small = (value & METHOD_LIST_T_SMALL_METHOD_FLAG) != 0 ;
412
+ listHeader.count = [cursor readInt32 ];
413
+ NSParameterAssert (listHeader.entsize == 3 * (small ? sizeof (int32_t ) : [self.machOFile ptrSize]));
414
+
413
415
for (uint32_t index = 0 ; index < listHeader.count ; index ++) {
414
416
struct cd_objc2_method objc2Method;
415
-
416
- objc2Method.name = [cursor readPtr ];
417
- objc2Method.types = [cursor readPtr ];
418
- objc2Method.imp = [cursor readPtr ];
417
+
418
+ objc2Method.name = [cursor readPtr: small ];
419
+ objc2Method.types = [cursor readPtr: small ];
420
+ objc2Method.imp = [cursor readPtr: small ];
419
421
NSString *name = [self .machOFile stringAtAddress: objc2Method.name];
420
422
NSString *types = [self .machOFile stringAtAddress: objc2Method.types];
421
423
@@ -424,7 +426,7 @@ - (NSArray *)loadMethodsAtAddress:(uint64_t)address extendedMethodTypesCursor:(C
424
426
types = [self .machOFile stringAtAddress: extendedMethodTypes];
425
427
}
426
428
427
- // NSLog(@"%3u: %016lx %016lx %016lx ", index, objc2Method.name, objc2Method.types, objc2Method.imp);
429
+ // NSLog(@"%3u: %016llx %016llx %016llx ", index, objc2Method.name, objc2Method.types, objc2Method.imp);
428
430
// NSLog(@"name: %@", name);
429
431
// NSLog(@"types: %@", types);
430
432
0 commit comments