objc

package
v0.0.0-...-b52216c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IsReplacement              ImageInfoFlag = 1 << 0 // used for Fix&Continue, now ignored
	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
	CorrectedSynthesize        ImageInfoFlag = 1 << 4 // used for an old workaround, now ignored
	IsSimulated                ImageInfoFlag = 1 << 5 // image compiled for a simulator platform
	HasCategoryClassProperties ImageInfoFlag = 1 << 6 // New ABI: category_t.classProperties fields are present, Old ABI: Set by some compilers. Not used by the runtime.
	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
	METHOD_LIST_IS_UNIQUED MLFlags = 1
	METHOD_LIST_FIXED_UP   MLFlags = 3
	METHOD_LIST_SMALL              = 0x80000000
)
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 (
	FAST_DATA_MASK   = 0xfffffffc
	FAST_DATA_MASK64 = 0x00007ffffffffff8
)
View Source
const (
	FAST_IS_SWIFT_LEGACY = 0x1 // < 5
	FAST_IS_SWIFT_STABLE = 0x2 // 5.X

	IsSwiftPreStableABI = 0x1
)
View Source
const IsDyldPreoptimized = 1 << 7

Variables

This section is empty.

Functions

This section is empty.

Types

type CFString

type CFString struct {
	Name    string
	Address uint64
	Class   *Class
	*CFString64T
}

CFString object in a 64-bit MachO file

type CFString64T

type CFString64T 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
}

CFString64T object in a 64-bit MachO file

type Category

type Category struct {
	Name            string
	VMAddr          uint64
	Class           *Class
	Protocol        *Protocol
	ClassMethods    []Method
	InstanceMethods []Method
	Properties      []Property
	CategoryT
}

func (*Category) String

func (c *Category) String() string

func (*Category) Verbose

func (c *Category) Verbose() string

type CategoryT

type CategoryT struct {
	NameVMAddr               uint64
	ClsVMAddr                uint64
	InstanceMethodsVMAddr    uint64
	ClassMethodsVMAddr       uint64
	ProtocolsVMAddr          uint64
	InstancePropertiesVMAddr uint64
}

type Class

type Class struct {
	Name                  string
	SuperClass            string
	Isa                   string
	InstanceMethods       []Method
	ClassMethods          []Method
	Ivars                 []Ivar
	Props                 []Property
	Prots                 []Protocol
	ClassPtr              uint64
	IsaVMAddr             uint64
	SuperclassVMAddr      uint64
	MethodCacheBuckets    uint64
	MethodCacheProperties uint64
	DataVMAddr            uint64
	IsSwiftLegacy         bool
	IsSwiftStable         bool
	ReadOnlyData          ClassRO64
}

func (*Class) String

func (c *Class) String() string

func (*Class) Verbose

func (c *Class) Verbose() string

type ClassRO

type ClassRO struct {
	Flags         ClassRoFlags
	InstanceStart uint32
	InstanceSize  uint32

	IvarLayoutVMAddr     uint32
	NameVMAddr           uint32
	BaseMethodsVMAddr    uint32
	BaseProtocolsVMAddr  uint32
	IvarsVMAddr          uint32
	WeakIvarLayoutVMAddr uint32
	BasePropertiesVMAddr uint32
	// contains filtered or unexported fields
}

type ClassRO64

type ClassRO64 struct {
	Flags         ClassRoFlags
	InstanceStart uint32
	InstanceSize  uint64
	// _                    uint32
	IvarLayoutVMAddr     uint64
	NameVMAddr           uint64
	BaseMethodsVMAddr    uint64
	BaseProtocolsVMAddr  uint64
	IvarsVMAddr          uint64
	WeakIvarLayoutVMAddr uint64
	BasePropertiesVMAddr uint64
}

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

func (f ClassRoFlags) HasFuture() bool

func (ClassRoFlags) IsMeta

func (f ClassRoFlags) IsMeta() bool

func (ClassRoFlags) IsRoot

func (f ClassRoFlags) IsRoot() bool

type ImageInfo

type ImageInfo struct {
	Version uint32
	Flags   ImageInfoFlag
}

type ImageInfoFlag

type ImageInfoFlag uint32

func (ImageInfoFlag) CorrectedSynthesize

func (f ImageInfoFlag) CorrectedSynthesize() bool

func (ImageInfoFlag) HasCategoryClassProperties

func (f ImageInfoFlag) HasCategoryClassProperties() bool

func (ImageInfoFlag) IsReplacement

func (f ImageInfoFlag) IsReplacement() bool

func (ImageInfoFlag) IsSimulated

func (f ImageInfoFlag) IsSimulated() bool

func (ImageInfoFlag) List

func (f ImageInfoFlag) List() []string

func (ImageInfoFlag) OptimizedByDyld

func (f ImageInfoFlag) OptimizedByDyld() bool

func (ImageInfoFlag) OptimizedByDyldClosure

func (f ImageInfoFlag) OptimizedByDyldClosure() bool

func (ImageInfoFlag) RequiresGC

func (f ImageInfoFlag) RequiresGC() bool

func (ImageInfoFlag) String

func (f ImageInfoFlag) String() string

func (ImageInfoFlag) SupportsGC

func (f ImageInfoFlag) SupportsGC() bool

func (ImageInfoFlag) SwiftVersion

func (f ImageInfoFlag) SwiftVersion() string

type ImpCache

type ImpCache struct {
	PreoptCacheT
	Entries []PreoptCacheEntryT
}

type Ivar

type Ivar struct {
	Name   string
	Type   string
	Offset uint32
	IvarT
}

func (*Ivar) String

func (i *Ivar) String() string

func (*Ivar) Verbose

func (i *Ivar) Verbose() string

type IvarList

type IvarList struct {
	EntSize uint32
	Count   uint32
}

type IvarT

type IvarT struct {
	Offset      uint64 // uint32_t*  (uint64_t* on x86_64)
	NameVMAddr  uint64 // const char*
	TypesVMAddr uint64 // const char*
	Alignment   uint32
	Size        uint32
}

type MLFlags

type MLFlags uint32

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

func (m *Method) ArgumentType(index int) string

func (*Method) NumberOfArguments

func (m *Method) NumberOfArguments() int

NumberOfArguments returns the number of method arguments

func (*Method) ReturnType

func (m *Method) ReturnType() string

ReturnType returns the method's return type

type MethodList

type MethodList struct {
	EntSizeAndFlags uint32
	Count           uint32
}

func (MethodList) EntSize

func (ml MethodList) EntSize() uint32

func (MethodList) FixedUp

func (ml MethodList) FixedUp() bool

func (MethodList) IsSmall

func (ml MethodList) IsSmall() bool

func (MethodList) IsUniqued

func (ml MethodList) IsUniqued() bool

func (MethodList) String

func (ml MethodList) String() string

type MethodSmallT

type MethodSmallT struct {
	NameOffset  int32 // SEL
	TypesOffset int32 // const char *
	ImpOffset   int32 // IMP
}

type MethodT

type MethodT struct {
	NameVMAddr  uint64 // SEL
	TypesVMAddr uint64 // const char *
	ImpVMAddr   uint64 // IMP
}

type ObjcClass64

type ObjcClass64 struct {
	IsaVMAddr              uint64
	SuperclassVMAddr       uint64
	MethodCacheBuckets     uint64
	MethodCacheProperties  uint64
	DataVMAddrAndFastFlags uint64
}

type ObjcClassT

type ObjcClassT struct {
	IsaVMAddr              uint32
	SuperclassVMAddr       uint32
	MethodCacheBuckets     uint32
	MethodCacheProperties  uint32
	DataVMAddrAndFastFlags uint32
}

type OptOffsets

type OptOffsets struct {
	MethodNameStart     uint64
	MethodNameEnd       uint64
	InlinedMethodsStart uint64
	InlinedMethodsEnd   uint64
}

type OptOffsets2

type OptOffsets2 struct {
	Version             uint64
	MethodNameStart     uint64
	MethodNameEnd       uint64
	InlinedMethodsStart uint64
	InlinedMethodsEnd   uint64
}

type PreoptCacheEntryT

type PreoptCacheEntryT struct {
	SelOffset uint32
	ImpOffset uint32
}

type PreoptCacheT

type PreoptCacheT struct {
	FallbackClassOffset int32
	Info                uint32
}

func (PreoptCacheT) BitOne

func (p PreoptCacheT) BitOne() bool

func (PreoptCacheT) CacheMask

func (p PreoptCacheT) CacheMask() uint32

func (PreoptCacheT) CacheShift

func (p PreoptCacheT) CacheShift() uint32

func (PreoptCacheT) Capacity

func (p PreoptCacheT) Capacity() uint32

func (PreoptCacheT) HasInlines

func (p PreoptCacheT) HasInlines() bool

func (PreoptCacheT) Occupied

func (p PreoptCacheT) Occupied() uint32

func (PreoptCacheT) String

func (p PreoptCacheT) String() string

type Property

type Property struct {
	PropertyT
	Name       string
	Attributes string
}

type PropertyList

type PropertyList struct {
	EntSize uint32
	Count   uint32
}

type PropertyT

type PropertyT struct {
	NameVMAddr       uint64
	AttributesVMAddr uint64
}

type Protocol

type Protocol struct {
	Name                    string
	Ptr                     uint64
	Isa                     *Class
	Prots                   []Protocol
	InstanceMethods         []Method
	InstanceProperties      []Property
	ClassMethods            []Method
	OptionalInstanceMethods []Method
	OptionalClassMethods    []Method
	ExtendedMethodTypes     string
	DemangledName           string
	ProtocolT
}

func (*Protocol) String

func (p *Protocol) String() string

func (*Protocol) Verbose

func (p *Protocol) Verbose() string

type ProtocolList

type ProtocolList struct {
	Count     uint64
	Protocols []uint64
}

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
}

type Selector

type Selector struct {
	VMAddr uint64
	Name   string
}

type SwiftClassMetadata

type SwiftClassMetadata struct {
	ObjcClassT
	SwiftClassFlags uint32
}

type SwiftClassMetadata64

type SwiftClassMetadata64 struct {
	ObjcClass64
	SwiftClassFlags uint64
}

type Toc

type Toc struct {
	ClassList        uint64
	NonLazyClassList uint64
	CatList          uint64
	NonLazyCatList   uint64
	ProtoList        uint64
	ClassRefs        uint64
	SuperRefs        uint64
	SelRefs          uint64
}

func (Toc) String

func (i Toc) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL