forked from qt-creator/qt-creator
ProjectExplorer: Store some aspect data by value in the RunControl
Change-Id: Idb7e119b5b0b483ce91efeb21fb415b654cfed4f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -786,13 +786,11 @@ void CallgrindToolPrivate::setupRunner(CallgrindToolRunner *toolRunner)
|
||||
QTC_ASSERT(m_visualization, return);
|
||||
|
||||
// apply project settings
|
||||
auto settings
|
||||
= qobject_cast<ValgrindBaseSettings *>(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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -58,11 +58,7 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl)
|
||||
runControl->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR);
|
||||
setSupportsReRunning(false);
|
||||
|
||||
m_settings =
|
||||
qobject_cast<ValgrindBaseSettings *>(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
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <utils/environment.h>
|
||||
#include <valgrind/valgrindrunner.h>
|
||||
#include <valgrind/valgrindsettings.h>
|
||||
|
||||
#include <QFutureInterface>
|
||||
#include <QFutureWatcher>
|
||||
@@ -53,7 +54,7 @@ protected:
|
||||
virtual QString progressTitle() const = 0;
|
||||
virtual QStringList toolArguments() const = 0;
|
||||
|
||||
ValgrindBaseSettings *m_settings = nullptr;
|
||||
ValgrindProjectSettings m_settings;
|
||||
QFutureInterface<void> m_progress;
|
||||
ValgrindRunner m_runner;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user