summaryrefslogtreecommitdiff
path: root/view/sharedcache
diff options
context:
space:
mode:
Diffstat (limited to 'view/sharedcache')
-rw-r--r--view/sharedcache/core/SharedCacheView.cpp4
-rw-r--r--view/sharedcache/core/Utility.cpp5
-rw-r--r--view/sharedcache/workflow/SharedCacheWorkflow.cpp15
3 files changed, 18 insertions, 6 deletions
diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp
index b226e302..e9699ab1 100644
--- a/view/sharedcache/core/SharedCacheView.cpp
+++ b/view/sharedcache/core/SharedCacheView.cpp
@@ -956,6 +956,10 @@ bool SharedCacheView::InitController()
m_logger->LogDebug("Loading images using pattern: %s", autoLoadPattern.c_str());
{
+ // TODO: Refusing to add undo action "Added section libsystem_c.dylib::__macho_header", there is literally
+ // TODO: no way around this warning as undo actions are implicit with user sections, for more detail see:
+ // TODO: - https://github.com/Vector35/binaryninja-api/issues/6742
+ // TODO: - https://github.com/Vector35/binaryninja-api/issues/6289
// Load all images that match the `autoLoadPattern`.
auto startTime = std::chrono::high_resolution_clock::now();
size_t loadedImages = 0;
diff --git a/view/sharedcache/core/Utility.cpp b/view/sharedcache/core/Utility.cpp
index 8f49c6bf..6f8323bf 100644
--- a/view/sharedcache/core/Utility.cpp
+++ b/view/sharedcache/core/Utility.cpp
@@ -90,8 +90,11 @@ void ApplySymbol(Ref<BinaryView> view, Ref<TypeLibrary> typeLib, Ref<Symbol> sym
// Make sure to check for already added function from the function table.
// Unless we have retrieved a type here we don't need to make a new function.
func = view->GetAnalysisFunction(targetPlatform, symbolAddress);
- if (!func || selectedType)
+ if (!func || selectedType != nullptr)
func = view->AddFunctionForAnalysis(targetPlatform, symbolAddress, false, selectedType);
+ // The above function might be overwritten so we also want to apply the type here.
+ if (func && selectedType != nullptr)
+ func->ApplyAutoDiscoveredType(selectedType);
}
else
{
diff --git a/view/sharedcache/workflow/SharedCacheWorkflow.cpp b/view/sharedcache/workflow/SharedCacheWorkflow.cpp
index cde8310c..3fce2e39 100644
--- a/view/sharedcache/workflow/SharedCacheWorkflow.cpp
+++ b/view/sharedcache/workflow/SharedCacheWorkflow.cpp
@@ -87,7 +87,7 @@ void IdentifyStub(BinaryView& view, const SharedCacheController& controller, uin
if (!symbol.has_value())
return;
- // Demangle if possible, the type pulled will be used, however type library will take precedence.
+ // TODO: The demangled type here is almost always wrong so we omit it for now.
auto [demangledName, demangledType] = symbol->DemangledName(view);
auto rawName = STUB_PREFIX + symbol->name;
auto shortName = STUB_PREFIX + demangledName;
@@ -97,13 +97,16 @@ void IdentifyStub(BinaryView& view, const SharedCacheController& controller, uin
{
// NOTE: The type library name is expected to be the image name currently.
// Try and pull the type from the associated type library (if there is one)
- Ref<Type> selectedType = demangledType;
+ // TODO: The demangled type here is missing a param
+ // Ref<Type> selectedType = demangledType;
+ Ref<Type> selectedType = nullptr;
if (const auto image = controller.GetImageContaining(symbolAddr))
if (auto typeLib = TypeLibraryFromName(view, image->name))
- selectedType = view.ImportTypeLibraryObject(typeLib, {symbol->name});
+ if (Ref<Type> libraryType = view.ImportTypeLibraryObject(typeLib, {symbol->name}); libraryType)
+ selectedType = libraryType;
- if (selectedType)
- targetFunc->SetAutoType(selectedType);
+ if (selectedType != nullptr)
+ targetFunc->ApplyAutoDiscoveredType(selectedType);
}
// Define the new symbol!
@@ -167,6 +170,8 @@ void AnalyzeStubFunction(Ref<Function> func, Ref<MediumLevelILFunction> mlil, Sh
if (defInstr.operation != MLIL_SET_VAR_SSA)
return;
expr = defInstr.GetSourceExpr<MLIL_SET_VAR_SSA>();
+ if (expr.operation != MLIL_LOAD_SSA)
+ return;
// Fallthrough to MLIL_LOAD_SSA.
}
case MLIL_LOAD_SSA: