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.
8 #include <mach/machine.h> // For cpu_type_t, cpu_subtype_t
9 #include <mach-o/loader.h>
11 typedef enum : NSUInteger
{
12 CDByteOrder_LittleEndian
= 0,
13 CDByteOrder_BigEndian
= 1,
17 @
class CDLCBuildVersion
, CDLCDyldInfo
, CDLCDylib
, CDMachOFile
, CDLCSymbolTable
, CDLCDynamicSymbolTable
, CDLCVersionMinimum
, CDLCSourceVersion
;
19 @interface CDMachOFile
: CDFile
21 @
property (readonly
) CDByteOrder byteOrder
;
23 @
property (readonly
) uint32_t magic
;
24 @
property (assign
) cpu_type_t cputype
;
25 @
property (assign
) cpu_subtype_t cpusubtype
;
26 @
property (readonly
) uint32_t filetype
;
27 @
property (readonly
) uint32_t flags
;
29 @
property (nonatomic
, readonly
) cpu_type_t maskedCPUType
;
30 @
property (nonatomic
, readonly
) cpu_subtype_t maskedCPUSubtype
;
32 @
property (readonly
) NSArray
*loadCommands
;
33 @
property (readonly
) NSArray
*dylibLoadCommands
;
34 @
property (readonly
) NSArray
*segments
;
35 @
property (readonly
) NSArray
*runPaths
;
36 @
property (readonly
) NSArray
*runPathCommands
;
37 @
property (readonly
) NSArray
*dyldEnvironment
;
38 @
property (readonly
) NSArray
*reExportedDylibs
;
40 @
property (strong
) CDLCSymbolTable
*symbolTable
;
41 @
property (strong
) CDLCDynamicSymbolTable
*dynamicSymbolTable
;
42 @
property (strong
) CDLCDyldInfo
*dyldInfo
;
43 @
property (strong
) CDLCDylib
*dylibIdentifier
;
44 @
property (strong
) CDLCVersionMinimum
*minVersionMacOSX
;
45 @
property (strong
) CDLCVersionMinimum
*minVersionIOS
;
46 @
property (strong
) CDLCSourceVersion
*sourceVersion
;
47 @
property (strong
) CDLCBuildVersion
*buildVersion
;
49 @
property (readonly
) BOOL uses64BitABI
;
50 - (NSUInteger
)ptrSize
;
52 - (NSString
*)filetypeDescription
;
53 - (NSString
*)flagDescription
;
55 - (CDLCSegment
*)dataConstSegment
;
56 - (CDLCSegment
*)segmentWithName
:(NSString
*)segmentName
;
57 - (CDLCSegment
*)segmentContainingAddress
:(NSUInteger
)address
;
58 - (NSString
*)stringAtAddress
:(NSUInteger
)address
;
60 - (NSUInteger
)dataOffsetForAddress
:(NSUInteger
)address
;
62 - (const void *)bytes
;
63 - (const void *)bytesAtOffset
:(NSUInteger
)offset
;
65 @
property (nonatomic
, readonly
) NSString
*importBaseName
;
67 @
property (nonatomic
, readonly
) BOOL isEncrypted
;
68 @
property (nonatomic
, readonly
) BOOL hasProtectedSegments
;
69 @
property (nonatomic
, readonly
) BOOL canDecryptAllSegments
;
71 - (NSString
*)loadCommandString
:(BOOL
)isVerbose
;
72 - (NSString
*)headerString
:(BOOL
)isVerbose
;
74 @
property (nonatomic
, readonly
) NSUUID
*UUID
;
75 @
property (nonatomic
, readonly
) NSString
*archName
;
77 - (Class
)processorClass
;
78 - (void)logInfoForAddress
:(NSUInteger
)address
;
80 - (NSString
*)externalClassNameForAddress
:(NSUInteger
)address
;
81 - (BOOL
)hasRelocationEntryForAddress
:(NSUInteger
)address
;
83 // Checks compressed dyld info on 10.6 or later.
84 - (BOOL
)hasRelocationEntryForAddress2
:(NSUInteger
)address
;
85 - (NSString
*)externalClassNameForAddress2
:(NSUInteger
)address
;
87 - (CDLCDylib
*)dylibLoadCommandForLibraryOrdinal
:(NSUInteger
)ordinal
;
89 @
property (nonatomic
, readonly
) BOOL hasObjectiveC1Data
;
90 @
property (nonatomic
, readonly
) BOOL hasObjectiveC2Data
;
91 @
property (nonatomic
, readonly
) Class processorClass
;