Skip to content

Commit 657d449

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 1367521 commit 657d449

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)
@@ -1863,9 +1879,12 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
18631879
Ref<Settings> programSettings = Settings::Instance();
18641880
if (programSettings->Contains("corePlugins.workflows.objc"))
18651881
{
1866-
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
1882+
// The Objective-C workflow plug-in will stop registering a named workflow at
1883+
// some point in favor adding activities to `core.function.metaAnalysis`.
1884+
if (Workflow::Instance("core.function.objectiveC")->IsRegistered())
18671885
{
1868-
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", this);
1886+
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
1887+
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", this);
18691888
}
18701889
}
18711890
}
@@ -4072,9 +4091,12 @@ Ref<Settings> MachoViewType::GetLoadSettingsForData(BinaryView* data)
40724091
Ref<Settings> programSettings = Settings::Instance();
40734092
if (programSettings->Contains("corePlugins.workflows.objc"))
40744093
{
4075-
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
4094+
// The Objective-C workflow plug-in will stop registering a named workflow at
4095+
// some point in favor adding activities to `core.function.metaAnalysis`.
4096+
if (Workflow::Instance("core.function.objectiveC")->IsRegistered())
40764097
{
4077-
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", viewRef);
4098+
if (programSettings->Get<bool>("corePlugins.workflows.objc"))
4099+
programSettings->Set("analysis.workflows.functionWorkflow", "core.function.objectiveC", viewRef);
40784100
}
40794101
}
40804102
}

0 commit comments

Comments
 (0)