summaryrefslogtreecommitdiff
path: root/objectivec/objc.h
diff options
context:
space:
mode:
authorMark Rowe <mrowe@bdash.net.nz>2025-02-17 11:04:35 -0800
committerMason Reed <mason@vector35.com>2025-04-03 12:17:12 -0400
commit254fd7b1f48c0e79889e4c786c7e507e7ac2e067 (patch)
tree07503712d127478725601f979b3d59a70cfc536e /objectivec/objc.h
parenta82ef16042a6abd97fd736545788952714809426 (diff)
[SharedCache] Fix detection of the class name of categories
The logic for determining the class name of a category did not correctly handle classes defined in other images in the shared cache. There were two problems: 1. If the class is defined in another image that is already loaded, `ObjCProcessor` has already renamed the symbol from `_OBJC_CLASS_$_` to `cls_`. Both forms of symbol name are now handled. 2. If the class is defined in an image that is not yet loaded, no symbol name is available. The category's class is now looked up in the shared cache symbol table, and the symbol's name is parsed as if it were an import symbol. This fixes almost all cases of "Failed to determine base classname for category" that I have come across. Mason Reed: Fixed up to make objective-c processor always consult GetSymbol
Diffstat (limited to 'objectivec/objc.h')
-rw-r--r--objectivec/objc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/objectivec/objc.h b/objectivec/objc.h
index 754d8d98..935773c1 100644
--- a/objectivec/objc.h
+++ b/objectivec/objc.h
@@ -324,6 +324,9 @@ namespace BinaryNinja {
virtual uint64_t GetObjCRelativeMethodBaseAddress(ObjCReader* reader);
virtual void GetRelativeMethod(ObjCReader* reader, method_t& meth);
virtual std::shared_ptr<ObjCReader> GetReader() = 0;
+ // Because an objective-c processor might have access to other non-view symbols that we want to retrieve.
+ // By default, this will just get symbol at the address in the view.
+ virtual Ref<Symbol> GetSymbol(uint64_t address);
public:
virtual ~ObjCProcessor() = default;