MCPcopy Create free account
hub / github.com/KDE/kdevelop / launchHeaptrack

Method launchHeaptrack

plugins/heaptrack/plugin.cpp:80–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void Plugin::launchHeaptrack()
81{
82 IExecutePlugin* executePlugin = nullptr;
83
84 // First we should check that our "kdevexecute" plugin is loaded. This is needed since
85 // current plugin controller logic allows us to unload this plugin with keeping dependent
86 // plugins like Heaptrack in "loaded" state. This seems to be wrong behaviour but now we have
87 // to do additional checks.
88 // TODO fix plugin controller to avoid such inconsistent states.
89 auto pluginController = core()->pluginController();
90 if (auto plugin = pluginController->pluginForExtension(
91 QStringLiteral("org.kdevelop.IExecutePlugin"), QStringLiteral("kdevexecute"))) {
92 executePlugin = plugin->extension<IExecutePlugin>();
93 } else {
94 auto pluginInfo = pluginController->infoForPluginId(QStringLiteral("kdevexecute"));
95 postErrorMessage(i18n("Unable to start Heaptrack analysis - \"%1\" plugin is not loaded.", pluginInfo.name()));
96 return;
97 }
98
99 auto runController = KDevelop::Core::self()->runControllerInternal();
100 auto defaultLaunch = runController->defaultLaunch();
101 if (!defaultLaunch) {
102 runController->showConfigurationDialog();
103 defaultLaunch = runController->defaultLaunch();
104 if (!defaultLaunch) {
105 postErrorMessage(i18n("Configure a native application launch to perform Heaptrack analysis on."));
106 return;
107 }
108 }
109
110 if (!defaultLaunch->type()->launcherForId(QStringLiteral("nativeAppLauncher"))) {
111 postErrorMessage(i18n("Heaptrack analysis can be started only for native applications."));
112 return;
113 }
114
115 auto heaptrackJob = new Job(defaultLaunch, executePlugin);
116 connect(heaptrackJob, &Job::finished, this, &Plugin::jobFinished);
117 runController->registerJob(makeJobWithDependency(heaptrackJob, *executePlugin, defaultLaunch));
118
119 m_launchAction->setEnabled(false);
120}
121
122void Plugin::attachHeaptrack()
123{

Callers

nothing calls this directly

Calls 13

postErrorMessageFunction · 0.85
makeJobWithDependencyFunction · 0.85
pluginControllerMethod · 0.80
infoForPluginIdMethod · 0.80
runControllerInternalMethod · 0.80
defaultLaunchMethod · 0.80
launcherForIdMethod · 0.80
registerJobMethod · 0.80
pluginForExtensionMethod · 0.45
nameMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected