Documentation
¶
Index ¶
- Constants
- Variables
- func CutType(typStr string) (string, string, bool)
- type CFString
- type CFString64Type
- type Category
- type CategoryT
- type Class
- type ClassRO
- type ClassRO64
- type ClassRoFlags
- type Entry
- type EntryList
- type ImageInfo
- type ImageInfoFlag
- func (f ImageInfoFlag) DyldCategoriesOptimized() bool
- func (f ImageInfoFlag) HasCategoryClassProperties() bool
- func (f ImageInfoFlag) IsSimulated() bool
- func (f ImageInfoFlag) List() []string
- func (f ImageInfoFlag) OptimizedByDyld() bool
- func (f ImageInfoFlag) OptimizedByDyldClosure() bool
- func (f ImageInfoFlag) RequiresGC() bool
- func (f ImageInfoFlag) SignedClassRO() bool
- func (f ImageInfoFlag) String() string
- func (f ImageInfoFlag) SupportsGC() bool
- func (f ImageInfoFlag) SwiftVersion() string
- type ImpCacheEntryV1
- type ImpCacheEntryV2
- type ImpCacheHeaderV1
- func (p ImpCacheHeaderV1) BitOne() bool
- func (p ImpCacheHeaderV1) CacheMask() uint32
- func (p ImpCacheHeaderV1) CacheShift() uint32
- func (p ImpCacheHeaderV1) Capacity() uint32
- func (p ImpCacheHeaderV1) HasInlines() bool
- func (p ImpCacheHeaderV1) Occupied() uint32
- func (p ImpCacheHeaderV1) String() string
- type ImpCacheHeaderV2
- func (p ImpCacheHeaderV2) BitOne() bool
- func (p ImpCacheHeaderV2) CacheMask() uint32
- func (p ImpCacheHeaderV2) CacheShift() uint32
- func (p ImpCacheHeaderV2) Capacity() uint32
- func (p ImpCacheHeaderV2) HasInlines() bool
- func (p ImpCacheHeaderV2) Occupied() uint32
- func (p ImpCacheHeaderV2) String() string
- type ImpCacheV1
- type ImpCacheV2
- type IntObj
- type Ivar
- type IvarList
- type IvarT
- type MLFlags
- type MLKind
- type Method
- type MethodList
- func (ml MethodList) EntSize() uint32
- func (ml MethodList) FixedUp() bool
- func (ml MethodList) Flags() MLFlags
- func (ml MethodList) IsUniqued() bool
- func (ml MethodList) Sorted() bool
- func (ml MethodList) String() string
- func (ml MethodList) UsesDirectOffsetsToSelectors() bool
- func (ml MethodList) UsesRelativeOffsets() bool
- type MethodT
- type ObjcClass64
- type ObjcClassT
- type OptOffsets
- type OptOffsets2
- type Property
- type PropertyList
- type PropertyT
- type Protocol
- type ProtocolList
- type ProtocolT
- type RelativeMethodT
- type Selector
- type Stub
- type SwiftClassMetadata
- type SwiftClassMetadata64
- type Toc
Constants ¶
View Source
const ( DyldCategoriesOptimized ImageInfoFlag = 1 << 0 // categories were optimized by dyld SupportsGC ImageInfoFlag = 1 << 1 // image supports GC RequiresGC ImageInfoFlag = 1 << 2 // image requires GC OptimizedByDyld ImageInfoFlag = 1 << 3 // image is from an optimized shared cache SignedClassRO ImageInfoFlag = 1 << 4 // class_ro_t pointers are signed IsSimulated ImageInfoFlag = 1 << 5 // image compiled for a simulator platform HasCategoryClassProperties ImageInfoFlag = 1 << 6 // class properties in category_t // OptimizedByDyldClosure is currently set by dyld, but we don't use it // anymore. Instead use // _dyld_objc_notify_mapped_info::dyldObjCRefsOptimized. // Once dyld stops setting it, it will be unused. OptimizedByDyldClosure ImageInfoFlag = 1 << 7 // dyld (not the shared cache) optimized this. // 1 byte Swift unstable ABI version number SwiftUnstableVersionMaskShift = 8 SwiftUnstableVersionMask = 0xff << SwiftUnstableVersionMaskShift // 2 byte Swift stable ABI version number SwiftStableVersionMaskShift = 16 SwiftStableVersionMask = 0xffff << SwiftStableVersionMaskShift )
View Source
const ( METHOD_LIST_FLAGS_MASK uint32 = 0xffff0003 // The size is bits 2 through 16 of the entsize field // The low 2 bits are uniqued/sorted as above. The upper 16-bits // are reserved for other flags METHOD_LIST_SIZE_MASK uint32 = 0x0000FFFC )
View Source
const ( CFStringEncodingMask = 0x0FF0 // mask to extract encoding from Info field CFStringEncodingASCII = 0x07C8 // UTF-8/ASCII encoding CFStringEncodingUnicode = 0x07D0 // UTF-16LE encoding )
CFString encoding constants (derived from Info field)
View Source
const ( FAST_IS_SWIFT_LEGACY = 1 << 0 // < 5 FAST_IS_SWIFT_STABLE = 1 << 1 // 5.X FAST_HAS_DEFAULT_RR = 1 << 2 IsSwiftPreStableABI = 0x1 )
View Source
const ( FAST_DATA_MASK = 0xfffffffc FAST_FLAGS_MASK = 0x00000003 FAST_DATA_MASK64_IPHONE = 0x0000007ffffffff8 FAST_DATA_MASK64 = 0x00007ffffffffff8 FAST_FLAGS_MASK64 = 0x0000000000000007 FAST_IS_RW_POINTER64 = 0x8000000000000000 )
View Source
const ( // Values for protocol_t->flags PROTOCOL_FIXED_UP_2 = (1 << 31) // must never be set by compiler PROTOCOL_FIXED_UP_1 = (1 << 30) // must never be set by compiler PROTOCOL_IS_CANONICAL = (1 << 29) // must never be set by compiler // Bits 0..15 are reserved for Swift's use. PROTOCOL_FIXED_UP_MASK = (PROTOCOL_FIXED_UP_1 | PROTOCOL_FIXED_UP_2) )
View Source
const IsDyldPreoptimized = 1 << 7
View Source
const (
WORD_SHIFT = 3 // assuming 64-bit pointers (log2(8))
)
Variables ¶
View Source
var ( // Start offset where fields may not be present on disk. ProtocolExtendedMethodTypesOffset = uint32(unsafe.Offsetof(ProtocolT{}.ExtendedMethodTypesVMAddr)) ProtocolDemangledNameOffset = uint32(unsafe.Offsetof(ProtocolT{}.DemangledNameVMAddr)) ProtocolClassPropertiesOffset = uint32(unsafe.Offsetof(ProtocolT{}.ClassPropertiesVMAddr)) )
Computed offsets for optional tail fields to avoid magic numbers in parsers.
Functions ¶
Types ¶
type CFString ¶ added in v1.1.1
type CFString struct {
Name string
ISA string
Address uint64
Class *Class
CFString64Type
}
CFString object in a 64-bit MachO file
type CFString64Type ¶ added in v1.1.135
type CFString64Type struct {
IsaVMAddr uint64 // class64_t * (64-bit pointer)
Info uint64 // flag bits
Data uint64 // char * (64-bit pointer)
Length uint64 // number of non-NULL characters in above
}
CFString64Type object in a 64-bit MachO file
func (CFString64Type) Encoding ¶ added in v1.1.258
func (c CFString64Type) Encoding() uint64
Encoding returns the string encoding type from the CFString Info field
func (CFString64Type) IsUTF16 ¶ added in v1.1.258
func (c CFString64Type) IsUTF16() bool
IsUTF16 returns true if the CFString uses UTF-16 encoding
type Category ¶
type Category struct {
Name string
VMAddr uint64
Class *Class
Protocols []Protocol
ClassMethods []Method
InstanceMethods []Method
Properties []Property
CategoryT
}
Category represents an Objective-C category.
type Class ¶
type Class struct {
Name string
SuperClass string
Isa string
InstanceMethods []Method
ClassMethods []Method
Ivars []Ivar
Props []Property
Protocols []Protocol
ClassPtr uint64
IsaVMAddr uint64
SuperclassVMAddr uint64
MethodCacheBuckets uint64
MethodCacheProperties uint64
DataVMAddr uint64
IsSwiftLegacy bool
IsSwiftStable bool
ReadOnlyData ClassRO64
}
type ClassRoFlags ¶
type ClassRoFlags uint32
const ( // class is a metaclass RO_META ClassRoFlags = (1 << 0) // class is a root class RO_ROOT ClassRoFlags = (1 << 1) // class has .cxx_construct/destruct implementations RO_HAS_CXX_STRUCTORS ClassRoFlags = (1 << 2) // class has +load implementation RO_HAS_LOAD_METHOD ClassRoFlags = (1 << 3) // class has visibility=hidden set RO_HIDDEN ClassRoFlags = (1 << 4) // class has attributeClassRoFlags = (objc_exception): OBJC_EHTYPE_$_ThisClass is non-weak RO_EXCEPTION ClassRoFlags = (1 << 5) // class has ro field for Swift metadata initializer callback RO_HAS_SWIFT_INITIALIZER ClassRoFlags = (1 << 6) // class compiled with ARC RO_IS_ARC ClassRoFlags = (1 << 7) // class has .cxx_destruct but no .cxx_construct ClassRoFlags = (with RO_HAS_CXX_STRUCTORS) RO_HAS_CXX_DTOR_ONLY ClassRoFlags = (1 << 8) // class is not ARC but has ARC-style weak ivar layout RO_HAS_WEAK_WITHOUT_ARC ClassRoFlags = (1 << 9) // class does not allow associated objects on instances RO_FORBIDS_ASSOCIATED_OBJECTS ClassRoFlags = (1 << 10) // class is in an unloadable bundle - must never be set by compiler RO_FROM_BUNDLE ClassRoFlags = (1 << 29) // class is unrealized future class - must never be set by compiler RO_FUTURE ClassRoFlags = (1 << 30) // class is realized - must never be set by compiler RO_REALIZED ClassRoFlags = (1 << 31) )
func (ClassRoFlags) HasCxxStructors ¶
func (f ClassRoFlags) HasCxxStructors() bool
func (ClassRoFlags) HasFuture ¶ added in v1.1.76
func (f ClassRoFlags) HasFuture() bool
func (ClassRoFlags) IsMeta ¶
func (f ClassRoFlags) IsMeta() bool
func (ClassRoFlags) IsRoot ¶
func (f ClassRoFlags) IsRoot() bool
func (ClassRoFlags) String ¶ added in v1.1.201
func (f ClassRoFlags) String() string
type Entry ¶ added in v1.1.157
type Entry int64
func (Entry) ImageIndex ¶ added in v1.1.159
func (Entry) MethodListOffset ¶ added in v1.1.157
type ImageInfo ¶
type ImageInfo struct {
Version uint32
Flags ImageInfoFlag
}
func (ImageInfo) IsDyldPreoptimized ¶ added in v1.1.102
type ImageInfoFlag ¶
type ImageInfoFlag uint32
func (ImageInfoFlag) DyldCategoriesOptimized ¶ added in v1.1.165
func (f ImageInfoFlag) DyldCategoriesOptimized() bool
DyldCategoriesOptimized
Indicates that dyld preattached categories from this image in the shared cache and we don't need to scan those categories ourselves. Note: this bit used to be used for the IsReplacement flag used for Fix & Continue. That usage is obsolete.
func (ImageInfoFlag) HasCategoryClassProperties ¶ added in v1.1.1
func (f ImageInfoFlag) HasCategoryClassProperties() bool
HasClassProperties
New ABI: category_t.classProperties fields are present. Old ABI: Set by some compilers. Not used by the runtime.
func (ImageInfoFlag) IsSimulated ¶ added in v1.1.1
func (f ImageInfoFlag) IsSimulated() bool
IsSimulated
Image was compiled for a simulator platform. Not used by the runtime.
func (ImageInfoFlag) List ¶ added in v1.1.1
func (f ImageInfoFlag) List() []string
func (ImageInfoFlag) OptimizedByDyld ¶ added in v1.1.1
func (f ImageInfoFlag) OptimizedByDyld() bool
OptimizedByDyld
Assorted metadata precooked in the dyld shared cache. Never set for images outside the shared cache file itself.
func (ImageInfoFlag) OptimizedByDyldClosure ¶ added in v1.1.1
func (f ImageInfoFlag) OptimizedByDyldClosure() bool
func (ImageInfoFlag) RequiresGC ¶ added in v1.1.1
func (f ImageInfoFlag) RequiresGC() bool
RequiresGC
Framework: GC is required.
func (ImageInfoFlag) SignedClassRO ¶ added in v1.1.102
func (f ImageInfoFlag) SignedClassRO() bool
func (ImageInfoFlag) String ¶ added in v1.1.1
func (f ImageInfoFlag) String() string
func (ImageInfoFlag) SupportsGC ¶ added in v1.1.1
func (f ImageInfoFlag) SupportsGC() bool
SupportsGC
App: GC is required. Framework: GC is supported but not required.
func (ImageInfoFlag) SwiftVersion ¶
func (f ImageInfoFlag) SwiftVersion() string
type ImpCacheEntryV1 ¶ added in v1.1.165
type ImpCacheEntryV2 ¶ added in v1.1.165
type ImpCacheEntryV2 uint64
func (ImpCacheEntryV2) GetImpOffset ¶ added in v1.1.165
func (e ImpCacheEntryV2) GetImpOffset() int64
func (ImpCacheEntryV2) GetSelOffset ¶ added in v1.1.165
func (e ImpCacheEntryV2) GetSelOffset() uint64
type ImpCacheHeaderV1 ¶ added in v1.1.165
func (ImpCacheHeaderV1) BitOne ¶ added in v1.1.165
func (p ImpCacheHeaderV1) BitOne() bool
func (ImpCacheHeaderV1) CacheMask ¶ added in v1.1.165
func (p ImpCacheHeaderV1) CacheMask() uint32
func (ImpCacheHeaderV1) CacheShift ¶ added in v1.1.165
func (p ImpCacheHeaderV1) CacheShift() uint32
func (ImpCacheHeaderV1) Capacity ¶ added in v1.1.165
func (p ImpCacheHeaderV1) Capacity() uint32
func (ImpCacheHeaderV1) HasInlines ¶ added in v1.1.165
func (p ImpCacheHeaderV1) HasInlines() bool
func (ImpCacheHeaderV1) Occupied ¶ added in v1.1.165
func (p ImpCacheHeaderV1) Occupied() uint32
func (ImpCacheHeaderV1) String ¶ added in v1.1.165
func (p ImpCacheHeaderV1) String() string
type ImpCacheHeaderV2 ¶ added in v1.1.165
func (ImpCacheHeaderV2) BitOne ¶ added in v1.1.165
func (p ImpCacheHeaderV2) BitOne() bool
func (ImpCacheHeaderV2) CacheMask ¶ added in v1.1.165
func (p ImpCacheHeaderV2) CacheMask() uint32
func (ImpCacheHeaderV2) CacheShift ¶ added in v1.1.165
func (p ImpCacheHeaderV2) CacheShift() uint32
func (ImpCacheHeaderV2) Capacity ¶ added in v1.1.165
func (p ImpCacheHeaderV2) Capacity() uint32
func (ImpCacheHeaderV2) HasInlines ¶ added in v1.1.165
func (p ImpCacheHeaderV2) HasInlines() bool
func (ImpCacheHeaderV2) Occupied ¶ added in v1.1.165
func (p ImpCacheHeaderV2) Occupied() uint32
func (ImpCacheHeaderV2) String ¶ added in v1.1.165
func (p ImpCacheHeaderV2) String() string
type ImpCacheV1 ¶ added in v1.1.165
type ImpCacheV1 struct {
ImpCacheHeaderV1
Entries []ImpCacheEntryV1
}
type ImpCacheV2 ¶ added in v1.1.165
type ImpCacheV2 struct {
ImpCacheHeaderV2
Entries []ImpCacheEntryV2
}
type IvarT ¶
type Method ¶
type Method struct {
NameVMAddr uint64 // & SEL
TypesVMAddr uint64 // & const char *
ImpVMAddr uint64 // & IMP
// We also need to know where the reference to the nameVMAddr was
// This is so that we know how to rebind that location
NameLocationVMAddr uint64
Name string
Types string
}
func (*Method) ArgumentType ¶ added in v1.1.19
func (*Method) NumberOfArguments ¶
NumberOfArguments returns the number of method arguments
func (*Method) ReturnType ¶
ReturnType returns the method's return type
type MethodList ¶
func (MethodList) EntSize ¶
func (ml MethodList) EntSize() uint32
func (MethodList) FixedUp ¶
func (ml MethodList) FixedUp() bool
func (MethodList) Flags ¶ added in v1.1.102
func (ml MethodList) Flags() MLFlags
func (MethodList) IsUniqued ¶
func (ml MethodList) IsUniqued() bool
func (MethodList) Sorted ¶ added in v1.1.107
func (ml MethodList) Sorted() bool
func (MethodList) String ¶
func (ml MethodList) String() string
func (MethodList) UsesDirectOffsetsToSelectors ¶ added in v1.1.107
func (ml MethodList) UsesDirectOffsetsToSelectors() bool
func (MethodList) UsesRelativeOffsets ¶ added in v1.1.107
func (ml MethodList) UsesRelativeOffsets() bool
type ObjcClass64 ¶
type ObjcClassT ¶
type OptOffsets ¶ added in v1.1.50
type OptOffsets2 ¶ added in v1.1.50
type Property ¶
func (*Property) Attributes ¶
type PropertyList ¶
type Protocol ¶
type Protocol struct {
Name string
Ptr uint64
Isa *Class
Prots []Protocol
InstanceMethods []Method
InstanceProperties []Property
ClassProperties []Property
ClassMethods []Method
OptionalInstanceMethods []Method
OptionalClassMethods []Method
ExtendedMethodTypes string
DemangledName string
ProtocolT
}
type ProtocolList ¶ added in v1.1.3
type ProtocolT ¶
type ProtocolT struct {
IsaVMAddr uint64
NameVMAddr uint64
ProtocolsVMAddr uint64
InstanceMethodsVMAddr uint64
ClassMethodsVMAddr uint64
OptionalInstanceMethodsVMAddr uint64
OptionalClassMethodsVMAddr uint64
InstancePropertiesVMAddr uint64
Size uint32
Flags uint32
// Fields below this point are not always present on disk.
ExtendedMethodTypesVMAddr uint64
DemangledNameVMAddr uint64
ClassPropertiesVMAddr uint64
}
func (ProtocolT) HasClassProperties ¶ added in v1.1.255
func (ProtocolT) HasDemangledName ¶ added in v1.1.255
func (ProtocolT) HasExtendedMethodTypes ¶ added in v1.1.255
Helpers to check if optional fields are present based on on-disk size.
type RelativeMethodT ¶ added in v1.1.107
type SwiftClassMetadata ¶
type SwiftClassMetadata struct {
ObjcClassT
SwiftClassFlags uint32
}
type SwiftClassMetadata64 ¶
type SwiftClassMetadata64 struct {
ObjcClass64
SwiftClassFlags uint64
}
Click to show internal directories.
Click to hide internal directories.