Valgrind: Allow specifying extra arguments to valgrind etc

Fixes: QTCREATORBUG-18693
Change-Id: Ibb968dcd82b118340a45329b4a14b28d85700661
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-02-17 11:00:36 +01:00
parent 5b9d8f0061
commit c5cc771656
8 changed files with 335 additions and 231 deletions

View File

@@ -131,7 +131,8 @@
You can write your own suppression files if parts of your project contain
errors you cannot fix and you do not want to be reminded of them. Click
\uicontrol Add in the \uicontrol {Memory Analysis} dialog to add the suppression files.
\uicontrol Add in the \uicontrol {MemCheck Memory Analysis} dialog to add
the suppression files.
For more information about writing suppression files, see
\l{http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress}
{Suppressing Errors} in the Valgrind documentation.
@@ -220,8 +221,8 @@
of the project.
To specify settings for Valgrind, select \uicontrol Tools >
\uicontrol Options > \uicontrol Analyzer. The \uicontrol {Profiling Options}
group contains Callgrind options.
\uicontrol Options > \uicontrol Analyzer. The \uicontrol
{Callgrind Profiling Options} group contains Callgrind options.
\image qtcreator-valgrind-callgrind-options.png "Valgrind options"

View File

@@ -35,6 +35,7 @@
#include <debugger/analyzer/analyzermanager.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
using namespace ProjectExplorer;
using namespace Valgrind::Callgrind;
@@ -96,6 +97,8 @@ QStringList CallgrindToolRunner::toolArguments() const
if (!m_argumentForToggleCollect.isEmpty())
arguments << m_argumentForToggleCollect;
arguments << Utils::QtcProcess::splitArgs(m_settings.callgrindArguments());
return arguments;
}

View File

@@ -220,6 +220,8 @@ QStringList MemcheckToolRunner::toolArguments() const
if (m_withGdb)
arguments << "--vgdb=yes" << "--vgdb-error=0";
arguments << Utils::QtcProcess::splitArgs(m_settings.memcheckArguments());
return arguments;
}

View File

@@ -93,6 +93,12 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
connect(m_ui->valgrindExeChooser, &Utils::PathChooser::rawPathChanged,
m_settings, &ValgrindBaseSettings::setValgrindExecutable);
connect(m_ui->valgrindArgumentsLineEdit, &QLineEdit::textChanged,
m_settings, &ValgrindBaseSettings::setValgrindArguments);
connect(m_settings, &ValgrindBaseSettings::valgrindArgumentsChanged,
m_ui->valgrindArgumentsLineEdit, &QLineEdit::setText);
connect(m_ui->smcDetectionComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
m_settings, &ValgrindBaseSettings::setSelfModifyingCodeDetection);
@@ -108,6 +114,11 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
//
m_ui->kcachegrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui->kcachegrindExeChooser->setPromptDialogTitle(tr("KCachegrind Command"));
connect(m_ui->callgrindArgumentsLineEdit, &QLineEdit::textChanged,
m_settings, &ValgrindBaseSettings::setCallgrindArguments);
connect(m_settings, &ValgrindBaseSettings::callgrindArgumentsChanged,
m_ui->callgrindArgumentsLineEdit, &QLineEdit::setText);
connect(m_ui->kcachegrindExeChooser, &Utils::PathChooser::rawPathChanged,
m_settings, &ValgrindBaseSettings::setKCachegrindExecutable);
connect(m_ui->enableCacheSim, &QCheckBox::toggled,
@@ -151,6 +162,11 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
m_ui->suppressionList->setModel(m_model);
m_ui->suppressionList->setSelectionMode(QAbstractItemView::MultiSelection);
connect(m_ui->memcheckArgumentsLineEdit, &QLineEdit::textChanged,
m_settings, &ValgrindBaseSettings::setMemcheckArguments);
connect(m_settings, &ValgrindBaseSettings::memcheckArgumentsChanged,
m_ui->memcheckArgumentsLineEdit, &QLineEdit::setText);
connect(m_ui->addSuppression, &QPushButton::clicked, this, &ValgrindConfigWidget::slotAddSuppression);
connect(m_ui->removeSuppression, &QPushButton::clicked, this, &ValgrindConfigWidget::slotRemoveSuppression);
@@ -204,6 +220,9 @@ ValgrindConfigWidget::~ValgrindConfigWidget()
void ValgrindConfigWidget::updateUi()
{
m_ui->valgrindExeChooser->setPath(m_settings->valgrindExecutable());
m_ui->valgrindArgumentsLineEdit->setText(m_settings->valgrindArguments());
m_ui->memcheckArgumentsLineEdit->setText(m_settings->memcheckArguments());
m_ui->callgrindArgumentsLineEdit->setText(m_settings->callgrindArguments());
m_ui->smcDetectionComboBox->setCurrentIndex(m_settings->selfModifyingCodeDetection());
m_ui->kcachegrindExeChooser->setPath(m_settings->kcachegrindExecutable());
m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim());

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>708</width>
<height>397</height>
<width>727</width>
<height>658</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@@ -20,34 +20,10 @@
</sizepolicy>
</property>
<property name="title">
<string>Generic Settings</string>
<string>Valgrind Generic Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="valgrindExeLabel">
<property name="text">
<string>Valgrind executable:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="valgrindExeChooser" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="smcDetectionLabel">
<property name="text">
<string>Detect self-modifying code:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="smcDetectionComboBox">
@@ -91,10 +67,249 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="valgrindExeLabel">
<property name="text">
<string>Valgrind executable:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="valgrindExeChooser" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="smcDetectionLabel">
<property name="text">
<string>Detect self-modifying code:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="valgrindArgumentsLabel">
<property name="text">
<string>Valgrind arguments:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="valgrindArgumentsLineEdit"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>500</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="memcheckOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>MemCheck Memory Analysis Options</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="trackOrigins">
<property name="text">
<string>Track origins of uninitialized memory</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="showReachable">
<property name="text">
<string>Show reachable and indirectly lost blocks</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="leakCheckOnFinishLabel">
<property name="text">
<string>Check for leaks on finish:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="leakCheckOnFinish">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Summary Only</string>
</property>
</item>
<item>
<property name="text">
<string>Full</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="numCallersLabel">
<property name="text">
<string>Backtrace frame count:</string>
</property>
<property name="buddy">
<cstring>numCallers</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSpinBox" name="numCallers">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="value">
<number>12</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Suppression files:</string>
</property>
<property name="buddy">
<cstring>suppressionList</cstring>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListView" name="suppressionList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QPushButton" name="addSuppression">
<property name="text">
<string>Add...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeSuppression">
<property name="text">
<string>Remove</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="memcheckArgumentsLabel">
<property name="text">
<string>Extra MemCheck arguments:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="memcheckArgumentsLineEdit"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="memcheckOptions_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -103,10 +318,10 @@
</sizepolicy>
</property>
<property name="title">
<string>Profiling Options</string>
<string>CallGrind Profiling Options</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="minimumInclusiveCostRatioLabel">
<property name="toolTip">
<string>Limits the amount of results the profiler gives you. A lower limit will likely increase performance.</string>
@@ -119,7 +334,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="minimumInclusiveCostRatio">
<property name="suffix">
<string>%</string>
@@ -135,7 +350,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="enableEventToolTips">
<property name="title">
<string>Show additional information for events in tooltips</string>
@@ -203,14 +418,14 @@ With cache simulation, further event counters are enabled:
</layout>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="visualisationMinimumInclusiveCostRatioLabel">
<property name="text">
<string>Visualization: Minimum event cost:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio">
<property name="prefix">
<string/>
@@ -226,14 +441,14 @@ With cache simulation, further event counters are enabled:
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<item row="1" column="0">
<widget class="QLabel" name="kcachgrindExeLabel">
<property name="text">
<string>KCachegrind executable:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="Utils::PathChooser" name="kcachegrindExeChooser" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -243,200 +458,15 @@ With cache simulation, further event counters are enabled:
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>500</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="memcheckOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Memory Analysis Options</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="trackOrigins">
<item row="0" column="0">
<widget class="QLabel" name="callgrindArgumentsLabel">
<property name="text">
<string>Track origins of uninitialized memory</string>
</property>
<property name="checked">
<bool>true</bool>
<string>Extra CallGrind arguments:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="showReachable">
<property name="text">
<string>Show reachable and indirectly lost blocks</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="leakCheckOnFinishLabel">
<property name="text">
<string>Check for leaks on finish:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="leakCheckOnFinish">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Summary Only</string>
</property>
</item>
<item>
<property name="text">
<string>Full</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="numCallersLabel">
<property name="text">
<string>Backtrace frame count:</string>
</property>
<property name="buddy">
<cstring>numCallers</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSpinBox" name="numCallers">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="value">
<number>12</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Suppression files:</string>
</property>
<property name="buddy">
<cstring>suppressionList</cstring>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListView" name="suppressionList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QPushButton" name="addSuppression">
<property name="text">
<string>Add...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeSuppression">
<property name="text">
<string>Remove</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
<item row="0" column="1">
<widget class="QLineEdit" name="callgrindArgumentsLineEdit"/>
</item>
</layout>
</widget>

View File

@@ -78,6 +78,7 @@ void ValgrindToolRunner::start()
#endif
CommandLine valgrind{m_settings.valgrindExecutable()};
valgrind.addArgs(m_settings.valgrindArguments(), CommandLine::Raw);
valgrind.addArgs(genericToolArguments());
valgrind.addArgs(toolArguments());

View File

@@ -45,6 +45,7 @@ const char removedSuppressionFilesC[] = "Analyzer.Valgrind.RemovedSuppressionFil
const char addedSuppressionFilesC[] = "Analyzer.Valgrind.AddedSuppressionFiles";
const char filterExternalIssuesC[] = "Analyzer.Valgrind.FilterExternalIssues";
const char visibleErrorKindsC[] = "Analyzer.Valgrind.VisibleErrorKinds";
const char memcheckArgumentsC[] = "Analyzer.Valgrind.Memcheck.Arguments";
const char lastSuppressionDirectoryC[] = "Analyzer.Valgrind.LastSuppressionDirectory";
const char lastSuppressionHistoryC[] = "Analyzer.Valgrind.LastSuppressionHistory";
@@ -61,8 +62,10 @@ const char callgrindVisualisationMinimumCostRatioC[] = "Analyzer.Valgrind.Callgr
const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
const char callgrindShortenTemplates[] = "Analyzer.Valgrind.Callgrind.ShortenTemplates";
const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
const char callgrindArgumentsC[] = "Analyzer.Valgrind.Callgrind.Arguments";
const char valgrindExeC[] = "Analyzer.Valgrind.ValgrindExecutable";
const char valgrindArgumentsC[] = "Analyzer.Valgrind.ValgrindArguments";
namespace Valgrind {
namespace Internal {
@@ -88,11 +91,13 @@ void ValgrindBaseSettings::fromMap(const QVariantMap &map)
{
// General
setIfPresent(map, valgrindExeC, &m_valgrindExecutable);
setIfPresent(map, valgrindArgumentsC, &m_valgrindArguments);
setIfPresent(map, selfModifyingCodeDetectionC,
(int*) &m_selfModifyingCodeDetection);
// Memcheck
setIfPresent(map, numCallersC, &m_numCallers);
setIfPresent(map, memcheckArgumentsC, &m_memcheckArguments);
setIfPresent(map, leakCheckOnFinishC, (int*) &m_leakCheckOnFinish);
setIfPresent(map, showReachableC, &m_showReachable);
setIfPresent(map, trackOriginsC, &m_trackOrigins);
@@ -104,6 +109,7 @@ void ValgrindBaseSettings::fromMap(const QVariantMap &map)
}
// Callgrind
setIfPresent(map, callgrindArgumentsC, &m_callgrindArguments);
setIfPresent(map, kcachegrindExeC, &m_kcachegrindExecutable);
setIfPresent(map, callgrindEnableCacheSimC, &m_enableCacheSim);
setIfPresent(map, callgrindEnableBranchSimC, &m_enableBranchSim);
@@ -121,9 +127,11 @@ void ValgrindBaseSettings::toMap(QVariantMap &map) const
{
// General
map.insert(valgrindExeC, m_valgrindExecutable);
map.insert(valgrindArgumentsC, m_valgrindArguments);
map.insert(selfModifyingCodeDetectionC, m_selfModifyingCodeDetection);
// Memcheck
map.insert(memcheckArgumentsC, m_memcheckArguments);
map.insert(numCallersC, m_numCallers);
map.insert(leakCheckOnFinishC, m_leakCheckOnFinish);
map.insert(showReachableC, m_showReachable);
@@ -135,6 +143,7 @@ void ValgrindBaseSettings::toMap(QVariantMap &map) const
map.insert(visibleErrorKindsC, errorKinds);
// Callgrind
map.insert(callgrindArgumentsC, m_callgrindArguments);
map.insert(kcachegrindExeC, m_kcachegrindExecutable);
map.insert(callgrindEnableCacheSimC, m_enableCacheSim);
map.insert(callgrindEnableBranchSimC, m_enableBranchSim);
@@ -151,6 +160,14 @@ void ValgrindBaseSettings::setValgrindExecutable(const QString &valgrindExecutab
m_valgrindExecutable = valgrindExecutable;
}
void ValgrindBaseSettings::setValgrindArguments(const QString &arguments)
{
if (m_valgrindArguments != arguments) {
m_valgrindArguments = arguments;
emit valgrindArgumentsChanged(arguments);
}
}
void ValgrindBaseSettings::setSelfModifyingCodeDetection(int smcDetection)
{
if (m_selfModifyingCodeDetection != smcDetection) {
@@ -159,6 +176,14 @@ void ValgrindBaseSettings::setSelfModifyingCodeDetection(int smcDetection)
}
}
void ValgrindBaseSettings::setMemcheckArguments(const QString &arguments)
{
if (m_memcheckArguments != arguments) {
m_memcheckArguments = arguments;
emit memcheckArgumentsChanged(arguments);
}
}
QString ValgrindBaseSettings::valgrindExecutable() const
{
return m_valgrindExecutable;
@@ -222,6 +247,14 @@ QString ValgrindBaseSettings::kcachegrindExecutable() const
return m_kcachegrindExecutable;
}
void ValgrindBaseSettings::setCallgrindArguments(const QString &arguments)
{
if (m_callgrindArguments != arguments) {
m_callgrindArguments = arguments;
emit callgrindArgumentsChanged(arguments);
}
}
void ValgrindBaseSettings::setKCachegrindExecutable(const QString &exec)
{
m_kcachegrindExecutable = exec;
@@ -396,9 +429,11 @@ void ValgrindGlobalSettings::readSettings()
// General
defaults.insert(valgrindExeC, "valgrind");
defaults.insert(valgrindArgumentsC, QString());
defaults.insert(selfModifyingCodeDetectionC, DetectSmcStackOnly);
// Memcheck
defaults.insert(memcheckArgumentsC, QString());
defaults.insert(numCallersC, 25);
defaults.insert(leakCheckOnFinishC, LeakCheckOnFinishSummaryOnly);
defaults.insert(showReachableC, false);
@@ -414,6 +449,7 @@ void ValgrindGlobalSettings::readSettings()
defaults.insert(lastSuppressionHistoryC, QStringList());
// Callgrind
defaults.insert(callgrindArgumentsC, QString());
defaults.insert(kcachegrindExeC, "kcachegrind");
defaults.insert(callgrindEnableCacheSimC, false);
defaults.insert(callgrindEnableBranchSimC, false);

View File

@@ -72,16 +72,20 @@ signals:
*/
public:
QString valgrindExecutable() const;
QString valgrindArguments() const { return m_valgrindArguments; }
SelfModifyingCodeDetection selfModifyingCodeDetection() const;
void setValgrindExecutable(const QString &);
void setValgrindArguments(const QString &arguments);
void setSelfModifyingCodeDetection(int);
signals:
void valgrindArgumentsChanged(const QString &arguments);
void selfModifyingCodeDetectionChanged(int);
private:
QString m_valgrindExecutable;
QString m_valgrindArguments;
SelfModifyingCodeDetection m_selfModifyingCodeDetection;
@@ -89,6 +93,7 @@ private:
* Base memcheck settings
*/
public:
QString memcheckArguments() const { return m_memcheckArguments; }
int numCallers() const { return m_numCallers; }
LeakCheckOnFinish leakCheckOnFinish() const { return m_leakCheckOnFinish; }
bool showReachable() const { return m_showReachable; }
@@ -100,6 +105,7 @@ public:
virtual void addSuppressionFiles(const QStringList &) = 0;
virtual void removeSuppressionFiles(const QStringList &) = 0;
void setMemcheckArguments(const QString &arguments);
void setNumCallers(int);
void setLeakCheckOnFinish(int);
void setShowReachable(bool);
@@ -108,6 +114,7 @@ public:
void setVisibleErrorKinds(const QList<int> &);
signals:
void memcheckArgumentsChanged(const QString &arguments);
void numCallersChanged(int);
void leakCheckOnFinishChanged(int);
void showReachableChanged(bool);
@@ -118,6 +125,7 @@ signals:
void suppressionFilesAdded(const QStringList &);
protected:
QString m_memcheckArguments;
int m_numCallers;
LeakCheckOnFinish m_leakCheckOnFinish;
bool m_showReachable;
@@ -129,6 +137,7 @@ protected:
* Base callgrind settings
*/
public:
QString callgrindArguments() const { return m_callgrindArguments;}
QString kcachegrindExecutable() const;
bool enableCacheSim() const { return m_enableCacheSim; }
@@ -143,6 +152,7 @@ public:
/// \return Minimum cost ratio, range [0.0..100.0]
double visualisationMinimumInclusiveCostRatio() const { return m_visualisationMinimumInclusiveCostRatio; }
void setCallgrindArguments(const QString &arguments);
void setKCachegrindExecutable(const QString &exec);
void setEnableCacheSim(bool enable);
void setEnableBranchSim(bool enable);
@@ -157,6 +167,7 @@ public:
void setVisualisationMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
signals:
void callgrindArgumentsChanged(const QString &argumnts);
void enableCacheSimChanged(bool);
void enableBranchSimChanged(bool);
void collectSystimeChanged(bool);
@@ -166,6 +177,7 @@ signals:
void visualisationMinimumInclusiveCostRatioChanged(double);
private:
QString m_callgrindArguments;
QString m_kcachegrindExecutable;
bool m_enableCacheSim;
bool m_collectSystime;