forked from qt-creator/qt-creator
Valgrind: Memcheck: Add gui options for --show-origins and --leak-check
Change-Id: If07c7a7a11a4c555e26b672bebb1e93eded38dc4 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -102,6 +102,24 @@ QStringList MemcheckRunControl::toolArguments() const
|
|||||||
if (m_settings->trackOrigins())
|
if (m_settings->trackOrigins())
|
||||||
arguments << QLatin1String("--track-origins=yes");
|
arguments << QLatin1String("--track-origins=yes");
|
||||||
|
|
||||||
|
if (m_settings->showReachable())
|
||||||
|
arguments << QLatin1String("--show-reachable=yes");
|
||||||
|
|
||||||
|
QString leakCheckValue;
|
||||||
|
switch (m_settings->leakCheckOnFinish()) {
|
||||||
|
case ValgrindBaseSettings::LeakCheckOnFinishNo:
|
||||||
|
leakCheckValue = QLatin1String("no");
|
||||||
|
break;
|
||||||
|
case ValgrindBaseSettings::LeakCheckOnFinishYes:
|
||||||
|
leakCheckValue = QLatin1String("full");
|
||||||
|
break;
|
||||||
|
case ValgrindBaseSettings::LeakCheckOnFinishSummaryOnly:
|
||||||
|
default:
|
||||||
|
leakCheckValue = QLatin1String("summary");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
arguments << QLatin1String("--leak-check=") + leakCheckValue;
|
||||||
|
|
||||||
foreach (const QString &file, m_settings->suppressionFiles())
|
foreach (const QString &file, m_settings->suppressionFiles())
|
||||||
arguments << QString::fromLatin1("--suppressions=%1").arg(file);
|
arguments << QString::fromLatin1("--suppressions=%1").arg(file);
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,16 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
|
|||||||
connect(m_ui->numCallers, SIGNAL(valueChanged(int)), m_settings, SLOT(setNumCallers(int)));
|
connect(m_ui->numCallers, SIGNAL(valueChanged(int)), m_settings, SLOT(setNumCallers(int)));
|
||||||
connect(m_settings, SIGNAL(numCallersChanged(int)), m_ui->numCallers, SLOT(setValue(int)));
|
connect(m_settings, SIGNAL(numCallersChanged(int)), m_ui->numCallers, SLOT(setValue(int)));
|
||||||
|
|
||||||
|
connect(m_ui->leakCheckOnFinish, SIGNAL(currentIndexChanged(int)),
|
||||||
|
m_settings, SLOT(setLeakCheckOnFinish(int)));
|
||||||
|
connect(m_settings, SIGNAL(leakCheckOnFinishChanged(int)),
|
||||||
|
m_ui->leakCheckOnFinish, SLOT(setCurrentIndex(int)));
|
||||||
|
|
||||||
|
connect(m_ui->showReachable, SIGNAL(toggled(bool)),
|
||||||
|
m_settings, SLOT(setShowReachable(bool)));
|
||||||
|
connect(m_settings, SIGNAL(showReachableChanged(bool)),
|
||||||
|
m_ui->showReachable, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
connect(m_ui->trackOrigins, SIGNAL(toggled(bool)),
|
connect(m_ui->trackOrigins, SIGNAL(toggled(bool)),
|
||||||
m_settings, SLOT(setTrackOrigins(bool)));
|
m_settings, SLOT(setTrackOrigins(bool)));
|
||||||
connect(m_settings, SIGNAL(trackOriginsChanged(bool)),
|
connect(m_settings, SIGNAL(trackOriginsChanged(bool)),
|
||||||
@@ -169,6 +179,8 @@ void ValgrindConfigWidget::updateUi()
|
|||||||
m_ui->minimumInclusiveCostRatio->setValue(m_settings->minimumInclusiveCostRatio());
|
m_ui->minimumInclusiveCostRatio->setValue(m_settings->minimumInclusiveCostRatio());
|
||||||
m_ui->visualisationMinimumInclusiveCostRatio->setValue(m_settings->visualisationMinimumInclusiveCostRatio());
|
m_ui->visualisationMinimumInclusiveCostRatio->setValue(m_settings->visualisationMinimumInclusiveCostRatio());
|
||||||
m_ui->numCallers->setValue(m_settings->numCallers());
|
m_ui->numCallers->setValue(m_settings->numCallers());
|
||||||
|
m_ui->leakCheckOnFinish->setCurrentIndex(m_settings->leakCheckOnFinish());
|
||||||
|
m_ui->showReachable->setChecked(m_settings->showReachable());
|
||||||
m_ui->trackOrigins->setChecked(m_settings->trackOrigins());
|
m_ui->trackOrigins->setChecked(m_settings->trackOrigins());
|
||||||
m_model->clear();
|
m_model->clear();
|
||||||
foreach (const QString &file, m_settings->suppressionFiles())
|
foreach (const QString &file, m_settings->suppressionFiles())
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>628</width>
|
<width>655</width>
|
||||||
<height>368</height>
|
<height>364</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
@@ -259,11 +259,71 @@ With cache simulation, further event counters are enabled:
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Memory Analysis Options</string>
|
<string>Memory Analysis Options</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout_4">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<item row="0" column="0" colspan="2">
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<widget class="QCheckBox" name="trackOrigins">
|
||||||
</property>
|
<property name="text">
|
||||||
|
<string>Track origins of uninitialized memory</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</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">
|
<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">
|
<widget class="QLabel" name="numCallersLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Backtrace frame count:</string>
|
<string>Backtrace frame count:</string>
|
||||||
@@ -273,7 +333,37 @@ With cache simulation, further event counters are enabled:
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<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">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Suppression files:</string>
|
<string>Suppression files:</string>
|
||||||
@@ -283,7 +373,7 @@ With cache simulation, further event counters are enabled:
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="5" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListView" name="suppressionList">
|
<widget class="QListView" name="suppressionList">
|
||||||
@@ -334,29 +424,6 @@ With cache simulation, further event counters are enabled:
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
|
||||||
<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 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>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -43,6 +43,8 @@
|
|||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
|
|
||||||
const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
|
const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
|
||||||
|
const char leakCheckOnFinishC[] = "Analyzer.Valgrind.LeakCheckOnFinish";
|
||||||
|
const char showReachableC[] = "Analyzer.Valgrind.ShowReachable";
|
||||||
const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
|
const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
|
||||||
const char selfModifyingCodeDetectionC[] = "Analyzer.Valgrind.SelfModifyingCodeDetection";
|
const char selfModifyingCodeDetectionC[] = "Analyzer.Valgrind.SelfModifyingCodeDetection";
|
||||||
const char suppressionFilesC[] = "Analyzer.Valgrind.SupressionFiles";
|
const char suppressionFilesC[] = "Analyzer.Valgrind.SupressionFiles";
|
||||||
@@ -95,6 +97,8 @@ void ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
|||||||
|
|
||||||
// Memcheck
|
// Memcheck
|
||||||
setIfPresent(map, QLatin1String(numCallersC), &m_numCallers);
|
setIfPresent(map, QLatin1String(numCallersC), &m_numCallers);
|
||||||
|
setIfPresent(map, QLatin1String(leakCheckOnFinishC), (int*) &m_leakCheckOnFinish);
|
||||||
|
setIfPresent(map, QLatin1String(showReachableC), &m_showReachable);
|
||||||
setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins);
|
setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins);
|
||||||
setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues);
|
setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues);
|
||||||
if (map.contains(QLatin1String(visibleErrorKindsC))) {
|
if (map.contains(QLatin1String(visibleErrorKindsC))) {
|
||||||
@@ -124,6 +128,8 @@ void ValgrindBaseSettings::toMap(QVariantMap &map) const
|
|||||||
|
|
||||||
// Memcheck
|
// Memcheck
|
||||||
map.insert(QLatin1String(numCallersC), m_numCallers);
|
map.insert(QLatin1String(numCallersC), m_numCallers);
|
||||||
|
map.insert(QLatin1String(leakCheckOnFinishC), m_leakCheckOnFinish);
|
||||||
|
map.insert(QLatin1String(showReachableC), m_showReachable);
|
||||||
map.insert(QLatin1String(trackOriginsC), m_trackOrigins);
|
map.insert(QLatin1String(trackOriginsC), m_trackOrigins);
|
||||||
map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues);
|
map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues);
|
||||||
QVariantList errorKinds;
|
QVariantList errorKinds;
|
||||||
@@ -176,6 +182,22 @@ void ValgrindBaseSettings::setNumCallers(int numCallers)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ValgrindBaseSettings::setLeakCheckOnFinish(int leakCheckOnFinish)
|
||||||
|
{
|
||||||
|
if (m_leakCheckOnFinish != leakCheckOnFinish) {
|
||||||
|
m_leakCheckOnFinish = (LeakCheckOnFinish) leakCheckOnFinish;
|
||||||
|
emit leakCheckOnFinishChanged(leakCheckOnFinish);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValgrindBaseSettings::setShowReachable(bool showReachable)
|
||||||
|
{
|
||||||
|
if (m_showReachable != showReachable) {
|
||||||
|
m_showReachable = showReachable;
|
||||||
|
emit showReachableChanged(showReachable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ValgrindBaseSettings::setTrackOrigins(bool trackOrigins)
|
void ValgrindBaseSettings::setTrackOrigins(bool trackOrigins)
|
||||||
{
|
{
|
||||||
if (m_trackOrigins != trackOrigins) {
|
if (m_trackOrigins != trackOrigins) {
|
||||||
@@ -368,6 +390,8 @@ void ValgrindGlobalSettings::readSettings()
|
|||||||
|
|
||||||
// Memcheck
|
// Memcheck
|
||||||
defaults.insert(QLatin1String(numCallersC), 25);
|
defaults.insert(QLatin1String(numCallersC), 25);
|
||||||
|
defaults.insert(QLatin1String(leakCheckOnFinishC), LeakCheckOnFinishSummaryOnly);
|
||||||
|
defaults.insert(QLatin1String(showReachableC), false);
|
||||||
defaults.insert(QLatin1String(trackOriginsC), true);
|
defaults.insert(QLatin1String(trackOriginsC), true);
|
||||||
defaults.insert(QLatin1String(filterExternalIssuesC), true);
|
defaults.insert(QLatin1String(filterExternalIssuesC), true);
|
||||||
QVariantList defaultErrorKinds;
|
QVariantList defaultErrorKinds;
|
||||||
|
|||||||
@@ -58,6 +58,12 @@ public:
|
|||||||
DetectSmcEverywhereButFile
|
DetectSmcEverywhereButFile
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum LeakCheckOnFinish {
|
||||||
|
LeakCheckOnFinishNo,
|
||||||
|
LeakCheckOnFinishSummaryOnly,
|
||||||
|
LeakCheckOnFinishYes
|
||||||
|
};
|
||||||
|
|
||||||
ValgrindBaseSettings() {}
|
ValgrindBaseSettings() {}
|
||||||
|
|
||||||
void toMap(QVariantMap &map) const;
|
void toMap(QVariantMap &map) const;
|
||||||
@@ -91,6 +97,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
public:
|
public:
|
||||||
int numCallers() const { return m_numCallers; }
|
int numCallers() const { return m_numCallers; }
|
||||||
|
LeakCheckOnFinish leakCheckOnFinish() const { return m_leakCheckOnFinish; }
|
||||||
|
bool showReachable() const { return m_showReachable; }
|
||||||
bool trackOrigins() const { return m_trackOrigins; }
|
bool trackOrigins() const { return m_trackOrigins; }
|
||||||
bool filterExternalIssues() const { return m_filterExternalIssues; }
|
bool filterExternalIssues() const { return m_filterExternalIssues; }
|
||||||
QList<int> visibleErrorKinds() const { return m_visibleErrorKinds; }
|
QList<int> visibleErrorKinds() const { return m_visibleErrorKinds; }
|
||||||
@@ -101,12 +109,16 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setNumCallers(int);
|
void setNumCallers(int);
|
||||||
|
void setLeakCheckOnFinish(int);
|
||||||
|
void setShowReachable(bool);
|
||||||
void setTrackOrigins(bool);
|
void setTrackOrigins(bool);
|
||||||
void setFilterExternalIssues(bool);
|
void setFilterExternalIssues(bool);
|
||||||
void setVisibleErrorKinds(const QList<int> &);
|
void setVisibleErrorKinds(const QList<int> &);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void numCallersChanged(int);
|
void numCallersChanged(int);
|
||||||
|
void leakCheckOnFinishChanged(int);
|
||||||
|
void showReachableChanged(bool);
|
||||||
void trackOriginsChanged(bool);
|
void trackOriginsChanged(bool);
|
||||||
void filterExternalIssuesChanged(bool);
|
void filterExternalIssuesChanged(bool);
|
||||||
void visibleErrorKindsChanged(const QList<int> &);
|
void visibleErrorKindsChanged(const QList<int> &);
|
||||||
@@ -115,6 +127,8 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_numCallers;
|
int m_numCallers;
|
||||||
|
LeakCheckOnFinish m_leakCheckOnFinish;
|
||||||
|
bool m_showReachable;
|
||||||
bool m_trackOrigins;
|
bool m_trackOrigins;
|
||||||
bool m_filterExternalIssues;
|
bool m_filterExternalIssues;
|
||||||
QList<int> m_visibleErrorKinds;
|
QList<int> m_visibleErrorKinds;
|
||||||
|
|||||||
Reference in New Issue
Block a user