From ea47d4c85e78533ea7e88adc442159414feb3f7f Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 13 Apr 2025 00:47:36 -0400 Subject: [SharedCache] Apply .symbols file information when applying an image This improves symbol recovery drastically on newer shared caches Related PR: https://github.com/Vector35/binaryninja-api/pull/6210 --- view/sharedcache/core/MachO.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'view/sharedcache/core/MachO.h') diff --git a/view/sharedcache/core/MachO.h b/view/sharedcache/core/MachO.h index 8508edbf..d3a720a9 100644 --- a/view/sharedcache/core/MachO.h +++ b/view/sharedcache/core/MachO.h @@ -7,6 +7,15 @@ struct CacheSymbol; +// Used when reading symbol/string table info. +struct TableInfo +{ + // VM address where the reading will begin. + uint64_t address; + // Number of entries in the table. + uint32_t entries; +}; + struct SharedCacheMachOHeader { uint64_t textBase = 0; @@ -61,8 +70,7 @@ struct SharedCacheMachOHeader static std::optional ParseHeaderForAddress( std::shared_ptr vm, uint64_t address, const std::string& imagePath); - // TODO: Replace view with address size? - std::vector ReadSymbolTable(BinaryNinja::BinaryView& view, VirtualMemory& vm) const; + std::vector ReadSymbolTable(VirtualMemory& vm, const TableInfo &symbolInfo, const TableInfo &stringInfo) const; bool AddExportTerminalSymbol( std::vector& symbols, const std::string& symbolName, const uint8_t* current, -- cgit v1.3.1