diff options
Diffstat (limited to 'view/sharedcache')
| -rw-r--r-- | view/sharedcache/core/ObjC.cpp | 22 | ||||
| -rw-r--r-- | view/sharedcache/core/ObjC.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/view/sharedcache/core/ObjC.cpp b/view/sharedcache/core/ObjC.cpp index bb483542..9fee4628 100644 --- a/view/sharedcache/core/ObjC.cpp +++ b/view/sharedcache/core/ObjC.cpp @@ -148,6 +148,28 @@ uint64_t SharedCacheObjCProcessor::GetObjCRelativeMethodBaseAddress(ObjCReader* return m_customRelativeMethodSelectorBase.value_or(0); } +Ref<Symbol> SharedCacheObjCProcessor::GetSymbol(uint64_t address) +{ + if (const auto symbol = m_data->GetSymbolByAddress(address)) + return symbol; + + const auto controller = DSC::SharedCacheController::FromView(*m_data); + if (!controller) + return nullptr; + + // No existing symbol located, try and search through the symbols of the cache. + auto cacheSymbol = controller->GetCache().GetSymbolAt(address); + if (!cacheSymbol.has_value()) + return nullptr; + + // Define the new symbol! + // While the method is "getting a symbol" and not applying it to the view, currently this is the more effective + // approach than monitoring every usage of this function to make sure they also define the symbol. + Ref<Symbol> symbol(new Symbol(cacheSymbol->type, cacheSymbol->name, address)); + m_data->DefineAutoSymbol(symbol); + return symbol; +} + SharedCacheObjCProcessor::SharedCacheObjCProcessor(BinaryView* data, bool isBackedByDatabase) : ObjCProcessor(data, "SharedCache.ObjC", isBackedByDatabase, true) {} diff --git a/view/sharedcache/core/ObjC.h b/view/sharedcache/core/ObjC.h index 6576564b..81e98f54 100644 --- a/view/sharedcache/core/ObjC.h +++ b/view/sharedcache/core/ObjC.h @@ -63,6 +63,8 @@ namespace DSCObjC { void GetRelativeMethod(BinaryNinja::ObjCReader* reader, BinaryNinja::method_t& meth) override; + BinaryNinja::Ref<BinaryNinja::Symbol> GetSymbol(uint64_t address) override; + public: SharedCacheObjCProcessor(BinaryNinja::BinaryView* data, bool isBackedByDatabase); |
