diff --git a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp index c8c8c22349c..7ed2cd9643d 100644 --- a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp +++ b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp @@ -106,14 +106,12 @@ public: upperPort = qmlServerPort; } if (m_usePerf) { - if (auto perfSettings = runControl()->settings("Analyzer.Perf.Settings")) { - QStringList perfRecordArgs = perfSettings - ->property("perfRecordArguments").toStringList(); - args.append(QString::fromLatin1(" --profile-perf %1").arg( - Utils::transform(perfRecordArgs, [](QString arg) { + QVariantMap settingsData = runControl()->settingsData("Analyzer.Perf.Settings"); + QVariant perfRecordArgs = settingsData.value("Analyzer.Perf.RecordArguments"); + QString args = Utils::transform(perfRecordArgs.toStringList(), [](QString arg) { return arg.replace(',', ",,"); - }).join(','))); - } + }).join(','); + args.append(QString(" --profile-perf %1").arg(args)); lowerPort = upperPort = perfPort; } args.append(QString(" --port-range %1-%2 ").arg(lowerPort).arg(upperPort)); diff --git a/src/plugins/perfprofiler/perfprofilerconstants.h b/src/plugins/perfprofiler/perfprofilerconstants.h index 32e174cf5d0..f29cecc7ca5 100644 --- a/src/plugins/perfprofiler/perfprofilerconstants.h +++ b/src/plugins/perfprofiler/perfprofilerconstants.h @@ -56,6 +56,7 @@ const char PerfCallgraphModeId[] = "Analyzer.Perf.CallgraphMode"; const char PerfEventsId[] = "Analyzer.Perf.Events"; const char PerfExtraArgumentsId[] = "Analyzer.Perf.ExtraArguments"; const char PerfSettingsId[] = "Analyzer.Perf.Settings"; +const char PerfRecordArgumentsId[] = "Analyzer.Perf.RecordArguments"; const unsigned int PerfDefaultPeriod = 250; const unsigned int PerfDefaultStackSize = 4096; diff --git a/src/plugins/perfprofiler/perfsettings.cpp b/src/plugins/perfprofiler/perfsettings.cpp index 8f7930e18be..b58e377ad3c 100644 --- a/src/plugins/perfprofiler/perfsettings.cpp +++ b/src/plugins/perfprofiler/perfsettings.cpp @@ -90,6 +90,7 @@ void PerfSettings::toMap(QVariantMap &map) const map[QLatin1String(Constants::PerfCallgraphModeId)] = m_callgraphMode; map[QLatin1String(Constants::PerfEventsId)] = m_events; map[QLatin1String(Constants::PerfExtraArgumentsId)] = m_extraArguments; + map[QLatin1String(Constants::PerfRecordArgumentsId)] = perfRecordArguments(); } void PerfSettings::fromMap(const QVariantMap &map) diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 0830211946f..c0a06f099ab 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -292,6 +292,14 @@ RunConfiguration *RunConfiguration::startupRunConfiguration() return nullptr; } +QMap RunConfiguration::aspectData() const +{ + QMap data; + for (ProjectConfigurationAspect *aspect : m_aspects) + aspect->toMap(data[aspect->id()]); + return data; +} + bool RunConfiguration::isConfigured() const { return true; diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index 9b1a223eb4b..d78aacaabcb 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -171,6 +171,8 @@ public: addAspectFactory([](Target *target) { return new T(target); }); } + QMap aspectData() const; + signals: void configurationFinished(); void enabledChanged(); diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index d31284d4347..4d32362fd07 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -325,6 +325,7 @@ public: MacroExpander *macroExpander; QPointer runConfiguration; // Not owned. Avoid use. QString buildKey; + QMap settingsData; Core::Id runConfigId; BuildTargetInfo buildTargetInfo; Kit *kit = nullptr; // Not owned. @@ -361,6 +362,8 @@ void RunControl::setRunConfiguration(RunConfiguration *runConfig) d->displayName = runConfig->displayName(); d->macroExpander = runConfig->macroExpander(); d->buildKey = runConfig->buildKey(); + d->settingsData = runConfig->aspectData(); + setTarget(runConfig->target()); } @@ -894,9 +897,9 @@ ProjectConfigurationAspect *RunControl::aspect(Core::Id id) const return d->runConfiguration ? d->runConfiguration->aspect(id) : nullptr; } -ISettingsAspect *RunControl::settings(Core::Id id) const +QVariantMap RunControl::settingsData(Core::Id id) const { - return d->runConfiguration ? d->runConfiguration->currentSettings(id) : nullptr; + return d->settingsData.value(id); } QString RunControl::buildKey() const diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index 3f3e78968c5..a9f55c1a243 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -227,9 +227,10 @@ public: return runConfiguration() ? runConfiguration()->aspect() : nullptr; } - ISettingsAspect *settings(Core::Id id) const; QString buildKey() const; + QVariantMap settingsData(Core::Id id) const; + Utils::FilePath targetFilePath() const; Utils::FilePath projectFilePath() const; diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp index d64bb0a3b8a..22512b7438f 100644 --- a/src/plugins/valgrind/callgrindengine.cpp +++ b/src/plugins/valgrind/callgrindengine.cpp @@ -77,18 +77,16 @@ QStringList CallgrindToolRunner::toolArguments() const { QStringList arguments = {"--tool=callgrind"}; - QTC_ASSERT(m_settings, return arguments); - - if (m_settings->enableCacheSim()) + if (m_settings.enableCacheSim()) arguments << "--cache-sim=yes"; - if (m_settings->enableBranchSim()) + if (m_settings.enableBranchSim()) arguments << "--branch-sim=yes"; - if (m_settings->collectBusEvents()) + if (m_settings.collectBusEvents()) arguments << "--collect-bus=yes"; - if (m_settings->collectSystime()) + if (m_settings.collectSystime()) arguments << "--collect-systime=yes"; if (m_markAsPaused) diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 5a78b2efaf0..0d8cc151099 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -786,13 +786,11 @@ void CallgrindToolPrivate::setupRunner(CallgrindToolRunner *toolRunner) QTC_ASSERT(m_visualization, return); // apply project settings - auto settings - = qobject_cast(runControl->settings(ANALYZER_VALGRIND_SETTINGS)); - if (settings) { - m_visualization->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0); - m_proxyModel.setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0); - m_dataModel.setVerboseToolTipsEnabled(settings->enableEventToolTips()); - } + ValgrindProjectSettings settings; + settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS)); + m_visualization->setMinimumInclusiveCostRatio(settings.visualisationMinimumInclusiveCostRatio() / 100.0); + m_proxyModel.setMinimumInclusiveCostRatio(settings.minimumInclusiveCostRatio() / 100.0); + m_dataModel.setVerboseToolTipsEnabled(settings.enableEventToolTips()); m_toolBusy = true; updateRunActions(); diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 5f43eee9422..72d33d719b4 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -191,16 +191,14 @@ QStringList MemcheckToolRunner::toolArguments() const { QStringList arguments = {"--tool=memcheck", "--gen-suppressions=all"}; - QTC_ASSERT(m_settings, return arguments); - - if (m_settings->trackOrigins()) + if (m_settings.trackOrigins()) arguments << "--track-origins=yes"; - if (m_settings->showReachable()) + if (m_settings.showReachable()) arguments << "--show-reachable=yes"; QString leakCheckValue; - switch (m_settings->leakCheckOnFinish()) { + switch (m_settings.leakCheckOnFinish()) { case ValgrindBaseSettings::LeakCheckOnFinishNo: leakCheckValue = "no"; break; @@ -214,10 +212,10 @@ QStringList MemcheckToolRunner::toolArguments() const } arguments << "--leak-check=" + leakCheckValue; - foreach (const QString &file, m_settings->suppressionFiles()) + foreach (const QString &file, m_settings.suppressionFiles()) arguments << QString("--suppressions=%1").arg(file); - arguments << QString("--num-callers=%1").arg(m_settings->numCallers()); + arguments << QString("--num-callers=%1").arg(m_settings.numCallers()); if (m_withGdb) arguments << "--vgdb=yes" << "--vgdb-error=0"; @@ -227,7 +225,7 @@ QStringList MemcheckToolRunner::toolArguments() const QStringList MemcheckToolRunner::suppressionFiles() const { - return m_settings->suppressionFiles(); + return m_settings.suppressionFiles(); } void MemcheckToolRunner::startDebugger(qint64 valgrindPid) diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 4b012e73304..486bbae244f 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -58,11 +58,7 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl) runControl->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR); setSupportsReRunning(false); - m_settings = - qobject_cast(runControl->settings(ANALYZER_VALGRIND_SETTINGS)); - - if (!m_settings) - m_settings = ValgrindGlobalSettings::instance(); + m_settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS)); } void ValgrindToolRunner::start() @@ -81,7 +77,7 @@ void ValgrindToolRunner::start() emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat); #endif - CommandLine valgrind{m_settings->valgrindExecutable()}; + CommandLine valgrind{m_settings.valgrindExecutable()}; valgrind.addArgs(genericToolArguments()); valgrind.addArgs(toolArguments()); @@ -125,9 +121,9 @@ FilePath ValgrindToolRunner::executable() const QStringList ValgrindToolRunner::genericToolArguments() const { - QTC_ASSERT(m_settings, return QStringList()); QString smcCheckValue; - switch (m_settings->selfModifyingCodeDetection()) { + + switch (m_settings.selfModifyingCodeDetection()) { case ValgrindBaseSettings::DetectSmcNo: smcCheckValue = "none"; break; @@ -178,7 +174,7 @@ void ValgrindToolRunner::receiveProcessOutput(const QString &output, OutputForma void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { - const QString valgrind = m_settings->valgrindExecutable(); + const QString valgrind = m_settings.valgrindExecutable(); if (!valgrind.isEmpty()) appendMessage(tr("Error: \"%1\" could not be started: %2").arg(valgrind, message), ErrorMessageFormat); else diff --git a/src/plugins/valgrind/valgrindengine.h b/src/plugins/valgrind/valgrindengine.h index f37ba22999a..30ffbdb22fe 100644 --- a/src/plugins/valgrind/valgrindengine.h +++ b/src/plugins/valgrind/valgrindengine.h @@ -26,10 +26,11 @@ #pragma once +#include "valgrindsettings.h" + #include #include #include -#include #include #include @@ -53,7 +54,7 @@ protected: virtual QString progressTitle() const = 0; virtual QStringList toolArguments() const = 0; - ValgrindBaseSettings *m_settings = nullptr; + ValgrindProjectSettings m_settings; QFutureInterface m_progress; ValgrindRunner m_runner;