diff options
| author | Mark Rowe <mrowe@bdash.net.nz> | 2024-11-24 22:28:04 -0800 |
|---|---|---|
| committer | Mark Rowe <mrowe@bdash.net.nz> | 2025-01-10 11:53:33 -0800 |
| commit | aa408cfdeaa3cd0c4319598223a4548b18731290 (patch) | |
| tree | e73da350192ff0ea942661c5850ee14a38accaaa /view/sharedcache/core/ObjC.h | |
| parent | a44b78355031ed429ac07f20a6439f07f9f47d9d (diff) | |
[SharedCache] Fix handling of relative selectors in macOS shared caches
Find the relative selector base address in the Objective-C optimization
data pointed to by the shared cache header, rather than via
`__objc_scoffs`. This is only present on iOS, and not for every iOS
version that encodes selectors via direct offsets.
This also includes some related improvements:
1. Direct selectors get their own pointer type so they're rendered
correctly in the view.
2. Method lists encoded as lists of lists are now handled.
3. The `dyld_cache_header` type added to the view is truncated to the
length in the loaded cache. This ensures it is applied to the view.
4. A couple of methods that process method IMPs and selectors are
updated to check whether the address is valid before attempting to
process them. They would otherwise fail by throwing an exception if
they proceed, but checking for validity is quicker and makes
exception breakpoints usable.
Diffstat (limited to 'view/sharedcache/core/ObjC.h')
| -rw-r--r-- | view/sharedcache/core/ObjC.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/view/sharedcache/core/ObjC.h b/view/sharedcache/core/ObjC.h index 016ff022..0f4526c0 100644 --- a/view/sharedcache/core/ObjC.h +++ b/view/sharedcache/core/ObjC.h @@ -58,6 +58,10 @@ namespace DSCObjC { typedef struct { uint64_t count; } protocol_list_t; + struct relative_list_list_entry_t { + uint64_t imageIndex: 16; + int64_t listOffset: 48; + }; typedef struct { view_ptr_t isa; view_ptr_t mangledName; @@ -214,8 +218,9 @@ namespace DSCObjC { std::vector<QualifiedNameOrType> ParseEncodedType(const std::string& type); void DefineObjCSymbol(BNSymbolType symbolType, QualifiedName typeName, const std::string& name, uint64_t addr, bool deferred); void DefineObjCSymbol(BNSymbolType symbolType, Ref<Type> type, const std::string& name, uint64_t addr, bool deferred); - void ReadIvarList(VMReader* reader, ClassBase& cls, std::string name, view_ptr_t start); - void ReadMethodList(VMReader* reader, ClassBase& cls, std::string name, view_ptr_t start); + void ReadIvarList(VMReader* reader, ClassBase& cls, std::string_view name, view_ptr_t start); + void ReadMethodList(VMReader* reader, ClassBase& cls, std::string_view name, view_ptr_t start); + void ReadListOfMethodLists(VMReader* reader, ClassBase& cls, std::string_view name, view_ptr_t start); void LoadClasses(VMReader* reader, Ref<Section> listSection); void LoadCategories(VMReader* reader, Ref<Section> listSection); void LoadProtocols(VMReader* reader, Ref<Section> listSection); |
