Documentation
¶
Index ¶
- Variables
- func NormalizeSwiftIvarTypeEncoding(enc string) string
- type MethodHandler
- type Reader
- func (f *Reader) ForEachMethod(addr uint64, handler MethodHandler) error
- func (f *Reader) GetCFStrings() ([]objc.CFString, error)
- func (f *Reader) GetObjC(addr uint64) (any, bool)
- func (f *Reader) GetObjCCategories() ([]objc.Category, error)
- func (f *Reader) GetObjCClass(vmaddr uint64) (*objc.Class, error)
- func (f *Reader) GetObjCClass2(vmaddr uint64) (*objc.Class, error)
- func (f *Reader) GetObjCClassInfo(vmaddr uint64) (*objc.ClassRO64, error)
- func (f *Reader) GetObjCClassNames() (map[uint64]string, error)
- func (f *Reader) GetObjCClassReferences() (map[uint64]*objc.Class, error)
- func (f *Reader) GetObjCClasses() ([]objc.Class, error)
- func (f *Reader) GetObjCImageInfo() (*objc.ImageInfo, error)
- func (f *Reader) GetObjCIntegerObjects() (map[uint64]*objc.IntObj, error)
- func (f *Reader) GetObjCIvars(vmaddr uint64) ([]objc.Ivar, error)
- func (f *Reader) GetObjCMethodLists() ([]objc.Method, error)
- func (f *Reader) GetObjCMethodNames() (map[uint64]string, error)
- func (f *Reader) GetObjCMethods(vmaddr uint64) ([]objc.Method, error)
- func (f *Reader) GetObjCNonLazyCategories() ([]objc.Category, error)
- func (f *Reader) GetObjCNonLazyClasses() ([]objc.Class, error)
- func (f *Reader) GetObjCProperties(vmaddr uint64) ([]objc.Property, error)
- func (f *Reader) GetObjCProtoReferences() (map[uint64]*objc.Protocol, error)
- func (f *Reader) GetObjCProtocols() ([]objc.Protocol, error)
- func (f *Reader) GetObjCSelectorReferences() (map[uint64]*objc.Selector, error)
- func (f *Reader) GetObjCStubs(parse func(uint64, []byte) (map[uint64]*objc.Stub, error)) (map[uint64]*objc.Stub, error)
- func (f *Reader) GetObjCSuperReferences() (map[uint64]*objc.Class, error)
- func (f *Reader) GetObjCToc() objc.Toc
- func (f *Reader) HasObjC() bool
- func (f *Reader) HasObjCMessageReferences() bool
- func (f *Reader) HasPlusLoadMethod() bool
- func (f *Reader) ObjCSelectorBaseUnavailable() bool
- func (f *Reader) PutObjC(addr uint64, obj any)
- type Source
Constants ¶
This section is empty.
Variables ¶
"ObjC relative method selectors require the shared cache's selector base, " +
"which is unavailable in a standalone dylib")
ErrObjCSelectorBaseUnavailable indicates a relative ObjC method list whose selectors are offsets into the shared cache's global selector-string table, which is not present when parsing a dylib in isolation (e.g. one extracted from a dyld_shared_cache). Such method names can only be resolved against the full cache.
var ErrObjcFragileRuntimeUnsupported = errors.New(
"objective-c fragile runtime metadata is unsupported")
var ErrObjcSectionNEmpty = errors.New("required ObjC section is empty")
var ErrObjcSectionNotFound = errors.New("missing required ObjC section")
Functions ¶
Types ¶
type MethodHandler ¶
MethodHandler receives the method entry's VM address in either list format.
type Reader ¶
type Reader struct {
Source
// contains filtered or unexported fields
}
Reader parses Objective-C metadata and owns the per-image ObjC cache.
func (*Reader) ForEachMethod ¶
func (f *Reader) ForEachMethod(addr uint64, handler MethodHandler) error
ForEachMethod decodes the method list at addr and calls handler for each entry until handler sets stop.
func (*Reader) GetCFStrings ¶
GetCFStrings returns the Objective-C CFStrings
func (*Reader) GetObjCCategories ¶
GetObjCCategories returns the Objective-C categories in __objc_catlist.
func (*Reader) GetObjCClass ¶
GetObjCClass parses an Objective-C class at a given virtual memory address.
func (*Reader) GetObjCClass2 ¶
GetObjCClass2 preserves the raw method-cache bucket field.
func (*Reader) GetObjCClassInfo ¶
GetObjCClassInfo returns the ClassRO64 (class_ro_t) for a given virtual memory address
func (*Reader) GetObjCClassNames ¶
GetObjCClassNames returns a map of section data virtual memory address to their class names
func (*Reader) GetObjCClassReferences ¶
GetObjCClassReferences returns a map of classes to their section data virtual memory address
func (*Reader) GetObjCClasses ¶
GetObjCClasses returns an array of Objective-C classes
func (*Reader) GetObjCImageInfo ¶
GetObjCImageInfo returns the parsed __objc_imageinfo data
func (*Reader) GetObjCIntegerObjects ¶
GetObjCIntObj parses the __objc_intobj section and returns a map of
func (*Reader) GetObjCIvars ¶
GetObjCIvars returns the Objective-C instance variables
func (*Reader) GetObjCMethodLists ¶
GetObjCMethodLists parses the method lists in the __objc_methlist section
func (*Reader) GetObjCMethodNames ¶
GetObjCMethodNames returns a map of section data virtual memory addresses to their method names
func (*Reader) GetObjCMethods ¶
func (*Reader) GetObjCNonLazyCategories ¶
GetObjCNonLazyCategories returns an array of Objective-C classes that implement +load
func (*Reader) GetObjCNonLazyClasses ¶
GetObjCNonLazyClasses returns an array of Objective-C classes that implement +load
func (*Reader) GetObjCProperties ¶
GetObjCProperties returns the Objective-C properties
func (*Reader) GetObjCProtoReferences ¶
GetObjCProtoReferences maps each protocol-reference slot to its protocol. It returns an error if a referenced protocol is unavailable or truncated.
func (*Reader) GetObjCProtocols ¶
GetObjCProtocols returns locally readable Objective-C protocol definitions. Unavailable external references are skipped; truncated records return an error.
func (*Reader) GetObjCSelectorReferences ¶
GetObjCSelectorReferences returns a map of selector names to their section data virtual memory address
func (*Reader) GetObjCStubs ¶
func (f *Reader) GetObjCStubs( parse func(uint64, []byte) (map[uint64]*objc.Stub, error), ) (map[uint64]*objc.Stub, error)
GetObjCStubs returns the Objective-C stubs
func (*Reader) GetObjCSuperReferences ¶
GetObjCSuperReferences returns a map of super classes to their section data virtual memory address
func (*Reader) GetObjCToc ¶
GetObjCToc returns a table of contents of the ObjC objects in the MachO
func (*Reader) HasObjCMessageReferences ¶
HasObjCMessageReferences returns true if MachO contains a __objc_msgrefs section
func (*Reader) HasPlusLoadMethod ¶
HasPlusLoadMethod returns true if MachO contains a __objc_nlclslist or __objc_nlcatlist section
func (*Reader) ObjCSelectorBaseUnavailable ¶
ObjCSelectorBaseUnavailable reports whether ObjC parsing encountered a relative method list whose selectors are offsets into the shared cache's global selector-string table. That table is absent when a dylib is parsed in isolation (e.g. extracted from a dyld_shared_cache), so such method names cannot be resolved without the full cache. See ErrObjCSelectorBaseUnavailable.
type Source ¶
type Source interface {
ByteOrder() binary.ByteOrder
DataReader() types.MachoReader
Sections() []*types.Section
SegmentNames() []string
Section(string, string) *types.Section
PointerSize() uint64
RelativeSelectorBase() uint64
ConvertPointer(uint64) uint64
GetOffset(uint64) (uint64, error)
CheckFileData(uint64, uint64) error
HasFileData(uint64, uint64) bool
HasZeroFillData(uint64, uint64) bool
AddressResolvable(uint64) bool
GetCString(uint64) (string, error)
GetUTF16String(uint64, uint64) (string, error)
GetPointerAtAddress(uint64) (uint64, error)
GetSlidPointerAtAddress(uint64) (uint64, error)
GetBindName(uint64) (string, error)
HasFixups() bool
SwiftSymbolicName(uint64) (string, error)
SwiftASCIITypeGuess(uint64) (string, bool)
SwiftFieldTypesForClass(string) (map[string]string, error)
SymbolicMangledNameStringRef(uint64) (string, error)
}
Source supplies the active Mach-O image and its address/Swift decoding services. Implementations must expose the live reader and layout rather than a stale snapshot.