3 // This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
4 // Copyright (C) 1997-2019 Steve Nygard.
6 #import "CDLCUnknown.h"
8 static BOOL debug = NO;
10 @implementation CDLCUnknown
12 struct load_command _loadCommand;
17 - (id)initWithDataCursor:(CDMachOFileDataCursor *)cursor;
19 if ((self = [super initWithDataCursor:cursor])) {
20 if (debug) NSLog(@"offset: %lu", [cursor offset]);
21 _loadCommand.cmd = [cursor readInt32];
22 _loadCommand.cmdsize = [cursor readInt32];
23 if (debug) NSLog(@"cmdsize: %u", _loadCommand.cmdsize);
25 if (_loadCommand.cmdsize > 8) {
26 NSMutableData *commandData = [[NSMutableData alloc] init];
27 [cursor appendBytesOfLength:_loadCommand.cmdsize - 8 intoData:commandData];
28 _commandData = [commandData copy];
41 return _loadCommand.cmd;
46 return _loadCommand.cmdsize;