@@ -180,7 +180,7 @@ CacheEntryId SharedCache::AddEntry(CacheEntry entry)
180180 m_vm->MapRegion (fileAccessor, {mapping.address , mapping.address + mapping.size }, mapping.fileOffset );
181181
182182 // Recalculate the base address.
183- if (mapping.address < m_baseAddress)
183+ if (mapping.address < m_baseAddress || m_baseAddress == 0 )
184184 m_baseAddress = mapping.address ;
185185 }
186186
@@ -456,8 +456,7 @@ bool CacheProcessor::ProcessCache(SharedCache& cache)
456456 // NOTE: This is extremely error-prone!
457457 // We are going to start trying to find files next to this one on disk!
458458 std::filesystem::path basePath = std::filesystem::path (baseFilePath).parent_path ();
459- std::string pattern = fmt::format (" .*{}\\ .([0-9]+|symbols|dylddata)$" , FileName (baseFilePath));
460- auto subCachePattern = std::regex (pattern);
459+ std::string baseFileName = FileName (baseFilePath);
461460 for (const auto &entry : std::filesystem::directory_iterator (basePath))
462461 {
463462 if (!entry.is_regular_file ())
@@ -468,8 +467,8 @@ bool CacheProcessor::ProcessCache(SharedCache& cache)
468467 if (currentFilePath == baseFilePath)
469468 continue ;
470469
471- // Filter files that dont end with .NUMBER or .symbols or .dylddata
472- if (! std::regex_match (currentFilePath, subCachePattern) )
470+ // Filter files that don't contain the base file name i.e. "dyld_shared_cache_arm64e"
471+ if (currentFilePath. find (baseFileName) == std::string::npos )
473472 continue ;
474473
475474 auto additionalEntry = CacheEntry::FromFile (currentFilePath, CacheEntryType::Secondary);
0 commit comments