diff options
| author | Mason Reed <mason@vector35.com> | 2025-04-08 13:17:30 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-04-08 13:21:48 -0400 |
| commit | a45466fc3227c615c72e77eb7368d7e83220b325 (patch) | |
| tree | 7a1060a6e98a0faa6fe81324553f65f4cafdbfed /view/sharedcache/core/ObjC.cpp | |
| parent | a6c5c22f08032374481aa060b59ef3492d124200 (diff) | |
Remove notion of image name from objective-c processor
This made the macho objective-c processor aware of images and was passed around everywhere, instead we have an overridable section getter that gives the control over the section retrieval to the derived processor.
In the case of shared cache this means we can store the image to be processed and then use the header to locate the relevant sections.
Fixes: https://github.com/Vector35/binaryninja-api/issues/6594
Diffstat (limited to 'view/sharedcache/core/ObjC.cpp')
| -rw-r--r-- | view/sharedcache/core/ObjC.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/view/sharedcache/core/ObjC.cpp b/view/sharedcache/core/ObjC.cpp index 9fee4628..dc5c3856 100644 --- a/view/sharedcache/core/ObjC.cpp +++ b/view/sharedcache/core/ObjC.cpp @@ -170,6 +170,25 @@ Ref<Symbol> SharedCacheObjCProcessor::GetSymbol(uint64_t address) return symbol; } -SharedCacheObjCProcessor::SharedCacheObjCProcessor(BinaryView* data, bool isBackedByDatabase) : - ObjCProcessor(data, "SharedCache.ObjC", isBackedByDatabase, true) -{} +Ref<Section> SharedCacheObjCProcessor::GetSectionWithName(const char *sectionName) +{ + const auto controller = DSC::SharedCacheController::FromView(*m_data); + if (!controller) + return nullptr; + + const auto image = controller->GetCache().GetImageAt(m_imageAddress); + if (!image) + return nullptr; + + for (const auto& section : image->header->sectionNames) + if (section.find(sectionName) != std::string::npos) + return m_data->GetSectionByName(section); + + return nullptr; +} + +SharedCacheObjCProcessor::SharedCacheObjCProcessor(BinaryView *data, bool isBackedByDatabase, uint64_t imageAddress) + : ObjCProcessor(data, "SharedCache.ObjC", isBackedByDatabase, true) +{ + m_imageAddress = imageAddress; +} |
