Skip to content

Commit 9db4d24

Browse files
committed
wip
1 parent b8def11 commit 9db4d24

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

view/sharedcache/api/python/sharedcache.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ def __init__(self, view: BinaryView):
113113
"""
114114
self.handle = sccore.BNGetSharedCacheController(view.handle)
115115

116+
def __del__(self):
117+
if self.handle is not None:
118+
sccore.BNFreeSharedCacheControllerReference(self.handle)
119+
116120
def __str__(self):
117121
return repr(self)
118122

view/sharedcache/core/MachO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ std::optional<CacheSymbol> SharedCacheMachOHeader::AddExportTerminalSymbol(const
593593
case EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE:
594594
return CacheSymbol(DataSymbol, symbolAddress, symbolName);
595595
default:
596-
LogWarn("Unhandled export symbol kind: %x", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
596+
LogWarn("Unhandled export symbol kind: %llx", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
597597
return std::nullopt;
598598
}
599599
}

view/sharedcache/core/SlideInfo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ std::vector<SlideMappingInfo> SlideInfoProcessor::ReadEntryInfo(VirtualMemory& v
235235
map.slideInfoVersion = vm.ReadUInt32(map.address);
236236
map.mappingInfo.address = mappingAndSlideInfo.address;
237237
map.mappingInfo.size = mappingAndSlideInfo.size;
238-
map.mappingInfo.fileOffset = mappingAndSlideInfo.fileOffset;
238+
map.mappingInfo.fileOffset = *entry.GetMappedAddress(mappingAndSlideInfo.fileOffset);
239239
if (map.slideInfoVersion == 2)
240240
{
241241
vm.Read(&map.slideInfoV2, map.address, sizeof(dyld_cache_slide_info_v2));
@@ -257,10 +257,10 @@ std::vector<SlideMappingInfo> SlideInfoProcessor::ReadEntryInfo(VirtualMemory& v
257257
}
258258

259259
mappings.emplace_back(map);
260-
m_logger->LogInfo("File: %s", entry.GetFilePath().c_str());
261-
m_logger->LogInfo("Slide Info Address: 0x%llx", map.address);
262-
m_logger->LogInfo("Mapping Address: 0x%llx", map.mappingInfo.address);
263-
m_logger->LogInfo("Slide Info Version: %d", map.slideInfoVersion);
260+
m_logger->LogDebug("File: %s", entry.GetFilePath().c_str());
261+
m_logger->LogDebug("Slide Info Address: 0x%llx", map.address);
262+
m_logger->LogDebug("Mapping Address: 0x%llx", map.mappingInfo.address);
263+
m_logger->LogDebug("Slide Info Version: %d", map.slideInfoVersion);
264264
}
265265

266266
return mappings;
@@ -299,6 +299,6 @@ void SlideInfoProcessor::ProcessEntry(VirtualMemory& vm, const CacheEntry &entry
299299
{
300300
// Just log an error, we technically can continue as if the slide info is not applied for a given entry it does not
301301
// necessarily mean we cannot do analysis on others.
302-
m_logger->LogError("Error processing slide info: %s", e.what());
302+
m_logger->LogError("Error processing slide info for entry `%s`: %s", entry.GetFileName().c_str(), e.what());
303303
}
304304
}

0 commit comments

Comments
 (0)