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 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 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 For more information about writing suppression files, see
\l{http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress} \l{http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress}
{Suppressing Errors} in the Valgrind documentation. {Suppressing Errors} in the Valgrind documentation.
@@ -220,8 +221,8 @@
of the project. of the project.
To specify settings for Valgrind, select \uicontrol Tools > To specify settings for Valgrind, select \uicontrol Tools >
\uicontrol Options > \uicontrol Analyzer. The \uicontrol {Profiling Options} \uicontrol Options > \uicontrol Analyzer. The \uicontrol
group contains Callgrind options. {Callgrind Profiling Options} group contains Callgrind options.
\image qtcreator-valgrind-callgrind-options.png "Valgrind options" \image qtcreator-valgrind-callgrind-options.png "Valgrind options"

View File

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

View File

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

View File

@@ -93,6 +93,12 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
connect(m_ui->valgrindExeChooser, &Utils::PathChooser::rawPathChanged, connect(m_ui->valgrindExeChooser, &Utils::PathChooser::rawPathChanged,
m_settings, &ValgrindBaseSettings::setValgrindExecutable); 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), connect(m_ui->smcDetectionComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
m_settings, &ValgrindBaseSettings::setSelfModifyingCodeDetection); m_settings, &ValgrindBaseSettings::setSelfModifyingCodeDetection);
@@ -108,6 +114,11 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
// //
m_ui->kcachegrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); m_ui->kcachegrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui->kcachegrindExeChooser->setPromptDialogTitle(tr("KCachegrind Command")); 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, connect(m_ui->kcachegrindExeChooser, &Utils::PathChooser::rawPathChanged,
m_settings, &ValgrindBaseSettings::setKCachegrindExecutable); m_settings, &ValgrindBaseSettings::setKCachegrindExecutable);
connect(m_ui->enableCacheSim, &QCheckBox::toggled, connect(m_ui->enableCacheSim, &QCheckBox::toggled,
@@ -151,6 +162,11 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
m_ui->suppressionList->setModel(m_model); m_ui->suppressionList->setModel(m_model);
m_ui->suppressionList->setSelectionMode(QAbstractItemView::MultiSelection); 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->addSuppression, &QPushButton::clicked, this, &ValgrindConfigWidget::slotAddSuppression);
connect(m_ui->removeSuppression, &QPushButton::clicked, this, &ValgrindConfigWidget::slotRemoveSuppression); connect(m_ui->removeSuppression, &QPushButton::clicked, this, &ValgrindConfigWidget::slotRemoveSuppression);
@@ -204,6 +220,9 @@ ValgrindConfigWidget::~ValgrindConfigWidget()
void ValgrindConfigWidget::updateUi() void ValgrindConfigWidget::updateUi()
{ {
m_ui->valgrindExeChooser->setPath(m_settings->valgrindExecutable()); 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->smcDetectionComboBox->setCurrentIndex(m_settings->selfModifyingCodeDetection());
m_ui->kcachegrindExeChooser->setPath(m_settings->kcachegrindExecutable()); m_ui->kcachegrindExeChooser->setPath(m_settings->kcachegrindExecutable());
m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim()); m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim());

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>708</width> <width>727</width>
<height>397</height> <height>658</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
@@ -20,34 +20,10 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title"> <property name="title">
<string>Generic Settings</string> <string>Valgrind Generic Settings</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="2" column="1">
<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">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QComboBox" name="smcDetectionComboBox"> <widget class="QComboBox" name="smcDetectionComboBox">
@@ -91,10 +67,249 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
</item> </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"> <widget class="QGroupBox" name="memcheckOptions_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -103,10 +318,10 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title"> <property name="title">
<string>Profiling Options</string> <string>CallGrind Profiling Options</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="minimumInclusiveCostRatioLabel"> <widget class="QLabel" name="minimumInclusiveCostRatioLabel">
<property name="toolTip"> <property name="toolTip">
<string>Limits the amount of results the profiler gives you. A lower limit will likely increase performance.</string> <string>Limits the amount of results the profiler gives you. A lower limit will likely increase performance.</string>
@@ -119,7 +334,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QDoubleSpinBox" name="minimumInclusiveCostRatio"> <widget class="QDoubleSpinBox" name="minimumInclusiveCostRatio">
<property name="suffix"> <property name="suffix">
<string>%</string> <string>%</string>
@@ -135,7 +350,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="enableEventToolTips"> <widget class="QGroupBox" name="enableEventToolTips">
<property name="title"> <property name="title">
<string>Show additional information for events in tooltips</string> <string>Show additional information for events in tooltips</string>
@@ -203,14 +418,14 @@ With cache simulation, further event counters are enabled:
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="visualisationMinimumInclusiveCostRatioLabel"> <widget class="QLabel" name="visualisationMinimumInclusiveCostRatioLabel">
<property name="text"> <property name="text">
<string>Visualization: Minimum event cost:</string> <string>Visualization: Minimum event cost:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio"> <widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio">
<property name="prefix"> <property name="prefix">
<string/> <string/>
@@ -226,14 +441,14 @@ With cache simulation, further event counters are enabled:
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="kcachgrindExeLabel">
<property name="text"> <property name="text">
<string>KCachegrind executable:</string> <string>KCachegrind executable:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="Utils::PathChooser" name="kcachegrindExeChooser" native="true"> <widget class="Utils::PathChooser" name="kcachegrindExeChooser" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -243,200 +458,15 @@ With cache simulation, further event counters are enabled:
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="0" column="0">
</widget> <widget class="QLabel" name="callgrindArgumentsLabel">
</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">
<property name="text"> <property name="text">
<string>Track origins of uninitialized memory</string> <string>Extra CallGrind arguments:</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="0" column="1">
<widget class="QCheckBox" name="showReachable"> <widget class="QLineEdit" name="callgrindArgumentsLineEdit"/>
<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> </item>
</layout> </layout>
</widget> </widget>

View File

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

View File

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

View File

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