Skip to content

Commit e2bf0e7

Browse files
committed
[MachO] Don't try to use the core.function.objectiveC workflow unless the Obj-C plug-in has created it
The Objective-C plug-in will stop registering a named workflow at some point in favor of adding activities to `core.function.metaAnalysis`. This ensures that the Mach-O view will handle that gracefully.
1 parent 5ecf8d5 commit e2bf0e7

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

view/macho/machoview.cpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,22 @@ bool MachoView::Init()
11111111
}
11121112
}
11131113
}
1114+
else
1115+
{
1116+
Ref<Settings> programSettings = Settings::Instance();
1117+
// If the Objective-C workflow plug-in is available and enabled, but its workflow is not registered,
1118+
// we are using a newer version of the plug-in that moved away from using a named workflow.
1119+
// Earlier versions of the Objective-C workflow plug-in used a named workflow rather than
1120+
// modifying `core.function.metaAnalysis`. Reference to the older workflow name need to be updated
1121+
// to `core.function.metaAnalysis`.
1122+
if (programSettings->Contains("corePlugins.workflows.objc") && programSettings->Get<bool>("corePlugins.workflows.objc") &&
1123+
!Workflow::Instance("core.function.objectiveC")->IsRegistered())
1124+
{
1125+
auto previousWorkflow = programSettings->Get<std::string>("analysis.workflows.functionWorkflow", this);
1126+
if (previousWorkflow == "core.function.objectiveC")
1127+
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.metaAnalysis", this);
1128+
}
1129+
}
11141130

11151131
m_imageBaseAdjustment = 0;
11161132
if (!initialImageBase)
@@ -1859,9 +1875,12 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
18591875
Ref<Settings> programSettings = Settings::Instance();
18601876
if (programSettings->Contains("corePlugins.workflows.objc"))
18611877
{
1862-
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
1878+
// The Objective-C workflow plug-in will stop registering a named workflow at
1879+
// some point in favor adding activities to `core.function.metaAnalysis`.
1880+
if (Workflow::Instance("core.function.objectiveC")->IsRegistered())
18631881
{
1864-
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", this);
1882+
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
1883+
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", this);
18651884
}
18661885
}
18671886
}
@@ -4059,9 +4078,12 @@ Ref<Settings> MachoViewType::GetLoadSettingsForData(BinaryView* data)
40594078
Ref<Settings> programSettings = Settings::Instance();
40604079
if (programSettings->Contains("corePlugins.workflows.objc"))
40614080
{
4062-
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
4081+
// The Objective-C workflow plug-in will stop registering a named workflow at
4082+
// some point in favor adding activities to `core.function.metaAnalysis`.
4083+
if (Workflow::Instance("core.function.objectiveC")->IsRegistered())
40634084
{
4064-
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", viewRef);
4085+
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
4086+
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", viewRef);
40654087
}
40664088
}
40674089
}

0 commit comments

Comments
 (0)