From e3bbd4fb8d3eaff44a16f19e1840e2ecd20387de Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Wed, 16 Apr 2025 16:34:01 -0400 Subject: [SharedCache] Support loading iOS shared caches older than 11 Still need to fix branch island images not being picked up --- view/sharedcache/core/SharedCacheView.cpp | 38 +++++++++++++++++-------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'view/sharedcache/core/SharedCacheView.cpp') diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp index 0cd4d82e..77f6e633 100644 --- a/view/sharedcache/core/SharedCacheView.cpp +++ b/view/sharedcache/core/SharedCacheView.cpp @@ -176,11 +176,27 @@ bool SharedCacheView::Init() m_logger = new Logger("SharedCache.View", GetFile()->GetSessionId()); uint32_t platform; + // NOTE: This entry only exists on ios 11 and later, older versions will just assume iOS. GetParentView()->Read(&platform, 0xd8, 4); char magic[17]; GetParentView()->Read(&magic, 0, 16); magic[16] = 0; + if (std::string(magic) == "dyld_v1 arm64" || std::string(magic) == "dyld_v1 arm64e" + || std::string(magic) == "dyld_v1arm64_32") + { + arch = "aarch64"; + } + else if (std::string(magic) == "dyld_v1 x86_64" || std::string(magic) == "dyld_v1 x86_64h") + { + arch = "x86_64"; + } + else + { + m_logger->LogError("Unknown magic: %s", magic); + return false; + } + // TODO: Do we want to add any warnings about platform support here? // TODO: Do we still consider macos experimental? switch (platform) @@ -200,24 +216,12 @@ bool SharedCacheView::Init() case DSCPlatformWatchOS: case DSCPlatformWatchOSSimulator: case DSCPlatformBridgeOS: - default: - m_logger->LogError("Unknown platform: %d", platform); - return false; - } - - if (std::string(magic) == "dyld_v1 arm64" || std::string(magic) == "dyld_v1 arm64e" - || std::string(magic) == "dyld_v1arm64_32") - { - arch = "aarch64"; - } - else if (std::string(magic) == "dyld_v1 x86_64" || std::string(magic) == "dyld_v1 x86_64h") - { - arch = "x86_64"; - } - else - { - m_logger->LogError("Unknown magic: %s", magic); + m_logger->LogError("Unsupported platform: %d", platform); return false; + default: + m_logger->LogWarn("Unknown platform: %d selecting iOS...", platform); + os = "ios"; + break; } SetDefaultPlatform(Platform::GetByName(os + "-" + arch)); -- cgit v1.3.1