summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCacheView.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-14 15:10:31 -0400
committerMason Reed <mason@vector35.com>2025-04-14 15:10:31 -0400
commit4f7d5e40861d73a3738b63f92d9ff5feb235f8d6 (patch)
treea371552fcf77671e91cc130fadfab57e57e25ad7 /view/sharedcache/core/SharedCacheView.cpp
parent507935f828188047ee009d2216a2c2d92c8b83fd (diff)
[SharedCache] Fix overzealous alert about missing shared cache entries
Following the conversation in https://github.com/Vector35/binaryninja-api/issues/6631 we are going to make the edited alerts warnings and then also fix the warning showing on certain shared caches even when all entries are present.
Diffstat (limited to 'view/sharedcache/core/SharedCacheView.cpp')
-rw-r--r--view/sharedcache/core/SharedCacheView.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp
index fb80d132..4218a2fe 100644
--- a/view/sharedcache/core/SharedCacheView.cpp
+++ b/view/sharedcache/core/SharedCacheView.cpp
@@ -861,16 +861,23 @@ bool SharedCacheView::InitController()
LogSecondaryFileName(entry.GetFileName());
// Set the number of sub-caches so we can verify it later.
if (entry.GetType() == CacheEntryType::Primary)
- expectedFileCount += entry.GetHeader().subCacheArrayCount;
+ {
+ const auto& entryHeader = entry.GetHeader();
+ // TODO: Some caches seem to have less sub caches than what we report having.
+ expectedFileCount += entryHeader.subCacheArrayCount;
+ // On older caches we don't have any sub-caches, so we want to skip alerting the user to that fact.
+ if (entryHeader.subCacheArrayOffset == 0)
+ expectedFileCount = 0;
+ }
}
for (const auto& missingFileName: missingCacheEntries)
m_logger->LogErrorF("Secondary cache file '{}' is missing!", missingFileName);
// Verify that we have the required amount of sub-caches, if not alert the user.
if (expectedFileCount == 1)
- 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);
+ m_logger->LogWarnF("Primary cache file '{}' has no sub-caches! You are likely opening a secondary cache file instead of a primary one.", m_primaryFileName);
else if (totalEntries < expectedFileCount)
- m_logger->LogAlertF("Insufficient cache files in dyld header ({}/{}), loading as partial shared cache...", totalEntries, expectedFileCount);
+ m_logger->LogWarnF("Insufficient cache files in dyld header ({}/{}), loading as partial shared cache...", totalEntries, expectedFileCount);
}
auto sharedCache = sharedCacheBuilder.Finalize();