diff options
| -rw-r--r-- | view/sharedcache/core/DSCView.cpp | 41 | ||||
| -rw-r--r-- | view/sharedcache/core/SharedCache.cpp | 43 | ||||
| -rw-r--r-- | view/sharedcache/core/SharedCache.h | 16 |
3 files changed, 69 insertions, 31 deletions
diff --git a/view/sharedcache/core/DSCView.cpp b/view/sharedcache/core/DSCView.cpp index f1528095..92fe2227 100644 --- a/view/sharedcache/core/DSCView.cpp +++ b/view/sharedcache/core/DSCView.cpp @@ -35,6 +35,15 @@ DSCView::~DSCView() enum DSCPlatform { DSCPlatformMacOS = 1, DSCPlatformiOS = 2, + DSCPlatformTVOS = 3, + DSCPlatformWatchOS = 4, + DSCPlatformBridgeOS = 5, // T1/T2 APL1023/T8012, this is your touchbar/touchid in intel macs. Similar to watchOS. + // DSCPlatformMacCatalyst = 6, + DSCPlatformiOSSimulator = 7, + DSCPlatformTVOSSimulator = 8, + DSCPlatformWatchOSSimulator = 9, + DSCPlatformVisionOS = 11, // Apple Vision Pro + DSCPlatformVisionOSSimulator = 12 // Apple Vision Pro Simulator }; bool DSCView::Init() @@ -47,21 +56,29 @@ bool DSCView::Init() char magic[17]; GetParentView()->Read(&magic, 0, 16); magic[16] = 0; - if (platform == DSCPlatformMacOS) + switch (platform) { - os = "mac"; - } - else if (platform == DSCPlatformiOS) - { - os = "ios"; - } - else - { - LogError("Unknown platform: %d", platform); - return false; + case DSCPlatformMacOS: + case DSCPlatformTVOS: + case DSCPlatformTVOSSimulator: + os = "mac"; + break; + case DSCPlatformiOS: + case DSCPlatformiOSSimulator: + case DSCPlatformVisionOS: + case DSCPlatformVisionOSSimulator: + os = "ios"; + break; + // armv7 or slide info v1 (unsupported) + case DSCPlatformWatchOS: + case DSCPlatformWatchOSSimulator: + case DSCPlatformBridgeOS: + default: + LogError("Unknown platform: %d", platform); + return false; } - if (std::string(magic) == "dyld_v1 arm64" || std::string(magic) == "dyld_v1 arm64e") + if (std::string(magic) == "dyld_v1 arm64" || std::string(magic) == "dyld_v1 arm64e" || std::string(magic) == "dyld_v1arm64_32") { arch = "aarch64"; } diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp index 6db1037d..0ba4f184 100644 --- a/view/sharedcache/core/SharedCache.cpp +++ b/view/sharedcache/core/SharedCache.cpp @@ -576,31 +576,36 @@ void SharedCache::PerformInitialLoad() } // Load .symbols subcache + try { + auto subCachePath = path + ".symbols"; + auto subCacheFile = MMappedFileAccessor::Open(m_dscView, m_dscView->GetFile()->GetSessionId(), subCachePath)->lock(); - auto subCachePath = path + ".symbols"; - auto subCacheFile = MMappedFileAccessor::Open(m_dscView, m_dscView->GetFile()->GetSessionId(), subCachePath)->lock(); + dyld_cache_header subCacheHeader {}; + uint64_t headerSize = subCacheFile->ReadUInt32(16); + if (headerSize > sizeof(dyld_cache_header)) + { + m_logger->LogDebug("Header size is larger than expected (0x%llx), using default size (0x%llx)", headerSize, + sizeof(dyld_cache_header)); + headerSize = sizeof(dyld_cache_header); + } + subCacheFile->Read(&subCacheHeader, 0, headerSize); - dyld_cache_header subCacheHeader {}; - uint64_t headerSize = subCacheFile->ReadUInt32(16); - if (headerSize > sizeof(dyld_cache_header)) - { - m_logger->LogDebug("Header size is larger than expected (0x%llx), using default size (0x%llx)", headerSize, - sizeof(dyld_cache_header)); - headerSize = sizeof(dyld_cache_header); - } - subCacheFile->Read(&subCacheHeader, 0, headerSize); + dyld_cache_mapping_info subCacheMapping {}; + BackingCache subCache; - dyld_cache_mapping_info subCacheMapping {}; - BackingCache subCache; + for (size_t j = 0; j < subCacheHeader.mappingCount; j++) + { + subCacheFile->Read(&subCacheMapping, subCacheHeader.mappingOffset + (j * sizeof(subCacheMapping)), + sizeof(subCacheMapping)); + subCache.mappings.push_back(subCacheMapping); + } - for (size_t j = 0; j < subCacheHeader.mappingCount; j++) + MutableState().backingCaches.push_back(std::move(subCache)); + } + catch (...) { - subCacheFile->Read(&subCacheMapping, subCacheHeader.mappingOffset + (j * sizeof(subCacheMapping)), - sizeof(subCacheMapping)); - subCache.mappings.push_back(subCacheMapping); + m_logger->LogWarn("Failed to locate .symbols subcache. Non-exported symbol information may be missing."); } - - MutableState().backingCaches.push_back(std::move(subCache)); break; } case iOS16CacheFormat: diff --git a/view/sharedcache/core/SharedCache.h b/view/sharedcache/core/SharedCache.h index 7bf8a7e0..8c06ff6e 100644 --- a/view/sharedcache/core/SharedCache.h +++ b/view/sharedcache/core/SharedCache.h @@ -127,6 +127,22 @@ namespace SharedCacheCore { dyld_cache_mapping_info mappingInfo; }; + struct dyld_cache_slide_info + { + uint32_t version; + uint32_t toc_offset; + uint32_t toc_count; + uint32_t entries_offset; + uint32_t entries_count; + uint32_t entries_size; + // uint16_t toc[toc_count]; + // entrybitmap entries[entries_count]; + }; + + struct dyld_cache_slide_info_entry { + uint8_t bits[4096/(8*4)]; // 128-byte bitmap + }; + struct PACKED_STRUCT dyld_cache_mapping_and_slide_info { uint64_t address; |
