From 578c5e77a60957a4d04eaac000679de3e5534e7b Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Thu, 3 Apr 2025 13:00:47 -0400 Subject: [SharedCache] Identify unloaded symbols that are called in standard functions Fixes https://github.com/Vector35/binaryninja-api/issues/6550 --- view/sharedcache/workflow/SharedCacheWorkflow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'view/sharedcache/workflow/SharedCacheWorkflow.cpp') diff --git a/view/sharedcache/workflow/SharedCacheWorkflow.cpp b/view/sharedcache/workflow/SharedCacheWorkflow.cpp index 7dde4089..186ba85a 100644 --- a/view/sharedcache/workflow/SharedCacheWorkflow.cpp +++ b/view/sharedcache/workflow/SharedCacheWorkflow.cpp @@ -220,6 +220,15 @@ void AnalyzeStubFunction(Ref func, Ref mlil, Sh void AnalyzeStandardFunction(Ref func, Ref mlil, SharedCacheController& controller) { auto view = func->GetView(); + auto identifyUnmappedSymbol = [&](uint64_t symbolAddr) { + // Skip if already loaded. + if (view->IsValidOffset(symbolAddr)) + return false; + const auto symbol = controller.GetSymbolAt(symbolAddr); + view->DefineAutoSymbol(symbol->GetBNSymbol(*view)); + return true; + }; + auto loadStubIslandRegion = [&](uint64_t regionAddr) { // Skip if already loaded. if (view->IsValidOffset(regionAddr)) @@ -239,6 +248,7 @@ void AnalyzeStandardFunction(Ref func, Ref mlil { case MLIL_CONST_PTR: loadStubIslandRegion(expr.GetConstant()); + identifyUnmappedSymbol(expr.GetConstant()); break; default: break; -- cgit v1.3.1