You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SharedCache] Improve the gathering of cache entries in view init
This commit addresses some of the issues regarding the retrieval of cache entries during view init, we now will try and store information in the database
about the given shared cache entries so that we can better alert the user to possible issues during the loading of saved shared cache databases. We also simplified
the logic so that the flow for retrieving the primary file cache is easier and users should be prompted when necessary to select the primary cache file if we cannot.
More errors will also be shown to provide the users with more information about the shared cache and what issues they might have. For example we will now try and warn the users
when they are opening a shared cache with less entries than what the shared cache reports having. We will also warn the users when opening a database if a previous secondary cache
file is no longer available.
In the future we can also utilize the shared cache UUID's for individual files to do a more aggressive search across directories in a project. This will make the file name lookup stuff
potentially unnecessary, at least when opening a database with all file UUID's stored.
for (constauto& entry : sharedCacheBuilder.GetCache().GetEntries())
886
846
{
887
-
if (entry.GetType() != CacheEntryType::Primary)
888
-
continue;
889
-
890
-
auto requiredCount = entry.GetHeader().subCacheArrayCount;
891
-
if (requiredCount <= entryCount)
892
-
continue;
893
-
894
-
m_logger->LogWarnF("Opening with {} entries when shared cache header says there are {}, likely missing files, prompting user to select a directory containing the rest.", entryCount, requiredCount);
895
-
// We don't have enough entries, prompt the user to select a directory with the rest.
896
-
std::string supplementaryDir;
897
-
if (GetDirectoryNameInput(supplementaryDir, "Directory with associated shared cache files"))
898
-
{
899
-
auto additionalEntries = sharedCacheBuilder.AddDirectory(primaryFileDir);
900
-
m_logger->LogInfoF("Processed an additional {} entries...", additionalEntries);
901
-
entryCount += additionalEntries;
902
-
// If we are still below the count, just let the user know and continue.
903
-
if (entryCount < requiredCount)
904
-
m_logger->LogWarnF("Provided entry files still below the reported entry count in the shared cache header. Some functionality may be lost.");
905
-
}
847
+
missingCacheEntries.erase(entry.GetFileName());
848
+
LogSecondaryFileName(entry.GetFileName());
849
+
// Set the number of sub-caches so we can verify it later.
for (constauto& missingFileName: missingCacheEntries)
854
+
m_logger->LogErrorF("Secondary cache file '{}' is missing!", missingFileName);
855
+
856
+
// Verify that we have the required amount of sub-caches, if not alert the user.
857
+
if (expectedFileCount == 1)
858
+
m_logger->LogAlertF("Primary cache file '{}' has no sub-caches! You are likely opening a secondary cache file instead of a primary one.", m_primaryFileName);
859
+
elseif (totalEntries < expectedFileCount)
860
+
m_logger->LogAlertF("Insufficient cache files in dyld header ({}/{}), loading as partial shared cache...", totalEntries, expectedFileCount);
0 commit comments