forked from qt-creator/qt-creator
analyzer: merge valgrind related settings
This mainly reduces the number of tabs in the settings dialog. Change-Id: I62ba5c74585648c8f495602cd4d676d0628de9b5 Reviewed-on: http://codereview.qt.nokia.com/1575 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -1,94 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "callgrindconfigwidget.h"
|
||||
|
||||
#include "ui_callgrindconfigwidget.h"
|
||||
|
||||
#include "callgrindsettings.h"
|
||||
|
||||
using namespace Valgrind::Internal;
|
||||
|
||||
CallgrindConfigWidget::CallgrindConfigWidget(AbstractCallgrindSettings *settings, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::CallgrindConfigWidget)
|
||||
, m_settings(settings)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim());
|
||||
connect(m_ui->enableCacheSim, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setEnableCacheSim(bool)));
|
||||
connect(m_settings, SIGNAL(enableCacheSimChanged(bool)),
|
||||
m_ui->enableCacheSim, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->enableBranchSim->setChecked(m_settings->enableBranchSim());
|
||||
connect(m_ui->enableBranchSim, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setEnableBranchSim(bool)));
|
||||
connect(m_settings, SIGNAL(enableBranchSimChanged(bool)),
|
||||
m_ui->enableBranchSim, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->collectSystime->setChecked(m_settings->collectSystime());
|
||||
connect(m_ui->collectSystime, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setCollectSystime(bool)));
|
||||
connect(m_settings, SIGNAL(collectSystimeChanged(bool)),
|
||||
m_ui->collectSystime, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->collectBusEvents->setChecked(m_settings->collectBusEvents());
|
||||
connect(m_ui->collectBusEvents, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setCollectBusEvents(bool)));
|
||||
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
|
||||
m_ui->collectBusEvents, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->enableEventToolTips->setChecked(m_settings->enableEventToolTips());
|
||||
connect(m_ui->enableEventToolTips, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setEnableEventToolTips(bool)));
|
||||
connect(m_settings, SIGNAL(enableEventToolTipsChanged(bool)),
|
||||
m_ui->enableEventToolTips, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->minimumInclusiveCostRatio->setValue(m_settings->minimumInclusiveCostRatio());
|
||||
connect(m_ui->minimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
||||
m_settings, SLOT(setMinimumInclusiveCostRatio(double)));
|
||||
connect(m_settings, SIGNAL(minimumInclusiveCostRatioChanged(double)),
|
||||
m_ui->minimumInclusiveCostRatio, SLOT(setValue(double)));
|
||||
|
||||
m_ui->visualisationMinimumInclusiveCostRatio->setValue(m_settings->visualisationMinimumInclusiveCostRatio());
|
||||
connect(m_ui->visualisationMinimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
||||
m_settings, SLOT(setVisualisationMinimumInclusiveCostRatio(double)));
|
||||
connect(m_settings, SIGNAL(visualisationMinimumInclusiveCostRatioChanged(double)),
|
||||
m_ui->visualisationMinimumInclusiveCostRatio, SLOT(setValue(double)));
|
||||
}
|
||||
|
||||
CallgrindConfigWidget::~CallgrindConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANALYZER_INTERNAL_CALLGRINDCONFIGWIDGET_H
|
||||
#define ANALYZER_INTERNAL_CALLGRINDCONFIGWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui {
|
||||
class CallgrindConfigWidget;
|
||||
}
|
||||
|
||||
class AbstractCallgrindSettings;
|
||||
|
||||
class CallgrindConfigWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
CallgrindConfigWidget(AbstractCallgrindSettings *settings, QWidget *parent);
|
||||
virtual ~CallgrindConfigWidget();
|
||||
|
||||
private:
|
||||
Ui::CallgrindConfigWidget *m_ui;
|
||||
AbstractCallgrindSettings *m_settings;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
#endif // ANALYZER_INTERNAL_CALLGRINDCONFIGWIDGET_H
|
||||
@@ -1,166 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Valgrind::Internal::CallgrindConfigWidget</class>
|
||||
<widget class="QWidget" name="Valgrind::Internal::CallgrindConfigWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>494</width>
|
||||
<height>565</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<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>Profiling Options</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" 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>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Result view: Show events with inclusive costs higher than:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>minimumInclusiveCostRatio</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="minimumInclusiveCostRatio">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="enableEventToolTips">
|
||||
<property name="title">
|
||||
<string>Show additional information for events in tooltips</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="enableCacheSim">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body>
|
||||
<p>Does full cache simulation.</p>
|
||||
<p>By default, only instruction read accesses will be counted ("Ir").</p>
|
||||
<p>
|
||||
With cache simulation, further event counters are enabled:
|
||||
<ul><li>Cache misses on instruction reads ("I1mr"/"I2mr")</li>
|
||||
<li>Data read accesses ("Dr") and related cache misses ("D1mr"/"D2mr")</li>
|
||||
<li>Data write accesses ("Dw") and related cache misses ("D1mw"/"D2mw")</li></ul>
|
||||
</p>
|
||||
|
||||
</body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable cache simulation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="enableBranchSim">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body>
|
||||
<p>Do branch prediction simulation.</p>
|
||||
<p>Further event counters are enabled: </p>
|
||||
<ul><li>Number of executed conditional branches and related predictor misses (
|
||||
"Bc"/"Bcm")</li>
|
||||
<li>Executed indirect jumps and related misses of the jump address predictor (
|
||||
"Bi"/"Bim")</li></ul></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable branch prediction simulation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="collectSystime">
|
||||
<property name="toolTip">
|
||||
<string>Collect information for system call times.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Collect system call time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="collectBusEvents">
|
||||
<property name="toolTip">
|
||||
<string>Collect the number of global bus events that are executed. The event type "Ge" is used for these events.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Collect global bus events</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="visualisationMinimumInclusiveCostRatioLabel">
|
||||
<property name="text">
|
||||
<string>Visualisation: Show events with inclusive costs higher than:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio">
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>50.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<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>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "callgrindengine.h"
|
||||
|
||||
#include "callgrindsettings.h"
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include <valgrind/callgrind/callgrindcontroller.h>
|
||||
#include <valgrind/callgrind/callgrindparser.h>
|
||||
@@ -67,7 +67,7 @@ QStringList CallgrindEngine::toolArguments() const
|
||||
{
|
||||
QStringList arguments;
|
||||
|
||||
AbstractCallgrindSettings *callgrindSettings = m_settings->subConfig<AbstractCallgrindSettings>();
|
||||
ValgrindBaseSettings *callgrindSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
||||
QTC_ASSERT(callgrindSettings, return arguments);
|
||||
|
||||
if (callgrindSettings->enableCacheSim())
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "callgrindsettings.h"
|
||||
|
||||
#include "callgrindconfigwidget.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
using namespace Analyzer;
|
||||
|
||||
static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.EnableCacheSim";
|
||||
static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
|
||||
static const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
|
||||
static const char callgrindCollectBusEventsC[] = "Analyzer.Valgrind.Callgrind.CollectBusEvents";
|
||||
static const char callgrindEnableEventToolTipsC[] = "Analyzer.Valgrind.Callgrind.EnableEventToolTips";
|
||||
static const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
|
||||
static const char callgrindVisualisationMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio";
|
||||
|
||||
static const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
|
||||
static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
void AbstractCallgrindSettings::setEnableCacheSim(bool enable)
|
||||
{
|
||||
if (m_enableCacheSim == enable)
|
||||
return;
|
||||
|
||||
m_enableCacheSim = enable;
|
||||
emit enableCacheSimChanged(enable);
|
||||
}
|
||||
|
||||
void AbstractCallgrindSettings::setEnableBranchSim(bool enable)
|
||||
{
|
||||
if (m_enableBranchSim == enable)
|
||||
return;
|
||||
|
||||
m_enableBranchSim = enable;
|
||||
emit enableBranchSimChanged(enable);
|
||||
}
|
||||
|
||||
void AbstractCallgrindSettings::setCollectSystime(bool collect)
|
||||
{
|
||||
if (m_collectSystime == collect)
|
||||
return;
|
||||
|
||||
m_collectSystime = collect;
|
||||
emit collectSystimeChanged(collect);
|
||||
}
|
||||
|
||||
void AbstractCallgrindSettings::setCollectBusEvents(bool collect)
|
||||
{
|
||||
if (m_collectBusEvents == collect)
|
||||
return;
|
||||
|
||||
m_collectBusEvents = collect;
|
||||
emit collectBusEventsChanged(collect);
|
||||
}
|
||||
|
||||
void AbstractCallgrindSettings::setEnableEventToolTips(bool enable)
|
||||
{
|
||||
if (m_enableEventToolTips == enable)
|
||||
return;
|
||||
|
||||
m_enableEventToolTips = enable;
|
||||
emit enableEventToolTipsChanged(enable);
|
||||
}
|
||||
|
||||
void AbstractCallgrindSettings::setMinimumInclusiveCostRatio(
|
||||
double minimumInclusiveCostRatio)
|
||||
{
|
||||
if (m_minimumInclusiveCostRatio == minimumInclusiveCostRatio)
|
||||
return;
|
||||
|
||||
m_minimumInclusiveCostRatio = qBound(0.0, minimumInclusiveCostRatio, 100.0);
|
||||
emit minimumInclusiveCostRatioChanged(minimumInclusiveCostRatio);
|
||||
}
|
||||
|
||||
void AbstractCallgrindSettings::setVisualisationMinimumInclusiveCostRatio(
|
||||
double minimumInclusiveCostRatio)
|
||||
{
|
||||
if (m_visualisationMinimumInclusiveCostRatio == minimumInclusiveCostRatio)
|
||||
return;
|
||||
|
||||
m_visualisationMinimumInclusiveCostRatio = qBound(0.0, minimumInclusiveCostRatio, 100.0);
|
||||
emit visualisationMinimumInclusiveCostRatioChanged(minimumInclusiveCostRatio);
|
||||
}
|
||||
|
||||
QVariantMap AbstractCallgrindSettings::defaults() const
|
||||
{
|
||||
QVariantMap map;
|
||||
map.insert(QLatin1String(callgrindEnableCacheSimC), false);
|
||||
map.insert(QLatin1String(callgrindEnableBranchSimC), false);
|
||||
map.insert(QLatin1String(callgrindCollectSystimeC), false);
|
||||
map.insert(QLatin1String(callgrindCollectBusEventsC), false);
|
||||
map.insert(QLatin1String(callgrindEnableEventToolTipsC), true);
|
||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.01);
|
||||
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), 10.0);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool AbstractCallgrindSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
setIfPresent(map, QLatin1String(callgrindEnableCacheSimC), &m_enableCacheSim);
|
||||
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
|
||||
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
|
||||
setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents);
|
||||
setIfPresent(map, QLatin1String(callgrindEnableEventToolTipsC), &m_enableEventToolTips);
|
||||
setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
|
||||
setIfPresent(map, QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
||||
&m_visualisationMinimumInclusiveCostRatio);
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap AbstractCallgrindSettings::toMap() const
|
||||
{
|
||||
QVariantMap map;
|
||||
map.insert(QLatin1String(callgrindEnableCacheSimC), m_enableCacheSim);
|
||||
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
|
||||
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
|
||||
map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents);
|
||||
map.insert(QLatin1String(callgrindEnableEventToolTipsC), m_enableEventToolTips);
|
||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
|
||||
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
||||
m_visualisationMinimumInclusiveCostRatio);
|
||||
return map;
|
||||
}
|
||||
|
||||
QString AbstractCallgrindSettings::id() const
|
||||
{
|
||||
return QLatin1String("Analyzer.Valgrind.Settings.Callgrind");
|
||||
}
|
||||
|
||||
QString AbstractCallgrindSettings::displayName() const
|
||||
{
|
||||
return tr("Profiling");
|
||||
}
|
||||
|
||||
QWidget *AbstractCallgrindSettings::createConfigWidget(QWidget *parent)
|
||||
{
|
||||
return new CallgrindConfigWidget(this, parent);
|
||||
}
|
||||
|
||||
|
||||
QVariantMap CallgrindGlobalSettings::defaults() const
|
||||
{
|
||||
QVariantMap map = AbstractCallgrindSettings::defaults();
|
||||
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
||||
map.insert(QLatin1String(callgrindCycleDetectionC), true);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool CallgrindGlobalSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
AbstractCallgrindSettings::fromMap(map);
|
||||
// special code as the default one does not cope with the enum properly
|
||||
if (map.contains(QLatin1String(callgrindCostFormatC))) {
|
||||
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
|
||||
}
|
||||
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap CallgrindGlobalSettings::toMap() const
|
||||
{
|
||||
QVariantMap map = AbstractCallgrindSettings::toMap();
|
||||
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
|
||||
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
|
||||
return map;
|
||||
}
|
||||
|
||||
CostDelegate::CostFormat CallgrindGlobalSettings::costFormat() const
|
||||
{
|
||||
return m_costFormat;
|
||||
}
|
||||
|
||||
void CallgrindGlobalSettings::setCostFormat(CostDelegate::CostFormat format)
|
||||
{
|
||||
m_costFormat = format;
|
||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
||||
}
|
||||
|
||||
bool CallgrindGlobalSettings::detectCycles() const
|
||||
{
|
||||
return m_detectCycles;
|
||||
}
|
||||
|
||||
void CallgrindGlobalSettings::setDetectCycles(bool detect)
|
||||
{
|
||||
m_detectCycles = detect;
|
||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
@@ -1,153 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANALYZER_INTERNAL_CALLGRINDSETTINGS_H
|
||||
#define ANALYZER_INTERNAL_CALLGRINDSETTINGS_H
|
||||
|
||||
#include "callgrindcostdelegate.h"
|
||||
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
/**
|
||||
* Generic callgrind settings
|
||||
*/
|
||||
class AbstractCallgrindSettings : public Analyzer::AbstractAnalyzerSubConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AbstractCallgrindSettings() {}
|
||||
|
||||
bool enableCacheSim() const { return m_enableCacheSim; }
|
||||
bool enableBranchSim() const { return m_enableBranchSim; }
|
||||
bool collectSystime() const { return m_collectSystime; }
|
||||
bool collectBusEvents() const { return m_collectBusEvents; }
|
||||
bool enableEventToolTips() const { return m_enableEventToolTips; }
|
||||
|
||||
/// \return Minimum cost ratio, range [0.0..100.0]
|
||||
double minimumInclusiveCostRatio() const { return m_minimumInclusiveCostRatio; }
|
||||
|
||||
/// \return Minimum cost ratio, range [0.0..100.0]
|
||||
double visualisationMinimumInclusiveCostRatio() const { return m_visualisationMinimumInclusiveCostRatio; }
|
||||
|
||||
// abstract virtual methods from base class
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
virtual QVariantMap defaults() const;
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QWidget *createConfigWidget(QWidget *parent);
|
||||
|
||||
public slots:
|
||||
void setEnableCacheSim(bool enable);
|
||||
void setEnableBranchSim(bool enable);
|
||||
void setCollectSystime(bool collect);
|
||||
void setCollectBusEvents(bool collect);
|
||||
void setEnableEventToolTips(bool enable);
|
||||
|
||||
/// \param minimumInclusiveCostRatio Minimum inclusive cost ratio, valid values are [0.0..100.0]
|
||||
void setMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
|
||||
|
||||
/// \param minimumInclusiveCostRatio Minimum inclusive cost ratio, valid values are [0.0..100.0]
|
||||
void setVisualisationMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
|
||||
|
||||
signals:
|
||||
void enableCacheSimChanged(bool);
|
||||
void enableBranchSimChanged(bool);
|
||||
void collectSystimeChanged(bool);
|
||||
void collectBusEventsChanged(bool);
|
||||
void enableEventToolTipsChanged(bool);
|
||||
void minimumInclusiveCostRatioChanged(double);
|
||||
void visualisationMinimumInclusiveCostRatioChanged(double);
|
||||
|
||||
protected:
|
||||
virtual QVariantMap toMap() const;
|
||||
|
||||
private:
|
||||
bool m_enableCacheSim;
|
||||
bool m_collectSystime;
|
||||
bool m_collectBusEvents;
|
||||
bool m_enableBranchSim;
|
||||
bool m_enableEventToolTips;
|
||||
double m_minimumInclusiveCostRatio;
|
||||
double m_visualisationMinimumInclusiveCostRatio;
|
||||
};
|
||||
|
||||
/**
|
||||
* Global callgrind settings
|
||||
*/
|
||||
class CallgrindGlobalSettings : public AbstractCallgrindSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CallgrindGlobalSettings() {}
|
||||
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
virtual QVariantMap defaults() const;
|
||||
|
||||
CostDelegate::CostFormat costFormat() const;
|
||||
bool detectCycles() const;
|
||||
|
||||
public slots:
|
||||
void setCostFormat(Valgrind::Internal::CostDelegate::CostFormat format);
|
||||
void setDetectCycles(bool detect);
|
||||
|
||||
protected:
|
||||
virtual QVariantMap toMap() const;
|
||||
|
||||
private:
|
||||
CostDelegate::CostFormat m_costFormat;
|
||||
bool m_detectCycles;
|
||||
};
|
||||
|
||||
/**
|
||||
* Per-project callgrind settings, saves a diff to the global suppression files list
|
||||
*/
|
||||
class CallgrindProjectSettings : public AbstractCallgrindSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CallgrindProjectSettings() {}
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
#endif // ANALYZER_INTERNAL_CALLGRINDSETTINGS_H
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "callgrindcostdelegate.h"
|
||||
#include "callgrindcostview.h"
|
||||
#include "callgrindengine.h"
|
||||
#include "callgrindsettings.h"
|
||||
#include "callgrindtextmark.h"
|
||||
#include "callgrindvisualisation.h"
|
||||
|
||||
@@ -48,6 +47,7 @@
|
||||
#include <valgrind/callgrind/callgrindproxymodel.h>
|
||||
#include <valgrind/callgrind/callgrindstackbrowser.h>
|
||||
#include <valgrind/valgrindplugin.h>
|
||||
#include <valgrind/valgrindsettings.h>
|
||||
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
QAction *m_showCostsOfFunctionAction;
|
||||
|
||||
QString m_toggleCollectFunction;
|
||||
CallgrindGlobalSettings *m_settings; // Not owned
|
||||
ValgrindGlobalSettings *m_settings; // Not owned
|
||||
};
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ CallgrindToolPrivate::CallgrindToolPrivate(CallgrindTool *parent)
|
||||
m_proxyModel->setFilterKeyColumn(DataModel::NameColumn);
|
||||
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
m_settings = AnalyzerGlobalSettings::instance()->subConfig<CallgrindGlobalSettings>();
|
||||
m_settings = AnalyzerGlobalSettings::instance()->subConfig<ValgrindGlobalSettings>();
|
||||
|
||||
connect(m_stackBrowser, SIGNAL(currentChanged()), SLOT(stackBrowserChanged()));
|
||||
connect(m_updateTimer, SIGNAL(timeout()), SLOT(updateFilterString()));
|
||||
@@ -520,7 +520,7 @@ QByteArray CallgrindTool::id() const
|
||||
|
||||
QString CallgrindTool::displayName() const
|
||||
{
|
||||
return tr("Valgrind Function Profile");
|
||||
return tr("Valgrind Function Profiler");
|
||||
}
|
||||
|
||||
QString CallgrindTool::description() const
|
||||
@@ -598,7 +598,7 @@ IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameter
|
||||
|
||||
// apply project settings
|
||||
AnalyzerProjectSettings *analyzerSettings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
|
||||
CallgrindProjectSettings *settings = analyzerSettings->subConfig<CallgrindProjectSettings>();
|
||||
ValgrindProjectSettings *settings = analyzerSettings->subConfig<ValgrindProjectSettings>();
|
||||
QTC_ASSERT(settings, return engine)
|
||||
|
||||
QTC_ASSERT(m_visualisation, return engine);
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = Memcheck
|
||||
|
||||
DEFINES += MEMCHECK_LIBRARY
|
||||
|
||||
include(../../qtcreatorplugin.pri)
|
||||
include(memcheck_dependencies.pri)
|
||||
|
||||
# Memcheck files
|
||||
|
||||
HEADERS += \
|
||||
memcheckplugin.h \
|
||||
memcheck_global.h \
|
||||
memchecktool.h \
|
||||
memcheckengine.h \
|
||||
memcheckerrorview.h \
|
||||
memchecksettings.h \
|
||||
memcheckconfigwidget.h \
|
||||
suppressiondialog.h
|
||||
|
||||
SOURCES += \
|
||||
memcheckplugin.cpp \
|
||||
memchecktool.cpp \
|
||||
memcheckengine.cpp \
|
||||
memcheckerrorview.cpp \
|
||||
memchecksettings.cpp \
|
||||
memcheckconfigwidget.cpp \
|
||||
suppressiondialog.cpp
|
||||
|
||||
FORMS += \
|
||||
suppressiondialog.ui \
|
||||
memcheckconfigwidget.ui \
|
||||
@@ -1,182 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator Instrumentation Tools
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "memcheckconfigwidget.h"
|
||||
|
||||
#include "ui_memcheckconfigwidget.h"
|
||||
|
||||
#include "memchecksettings.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QStandardItemModel>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
MemcheckConfigWidget::MemcheckConfigWidget(AbstractMemcheckSettings *settings, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_settings(settings),
|
||||
m_model(new QStandardItemModel(this)),
|
||||
m_ui(new Ui::MemcheckConfigWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->suppressionList->setModel(m_model);
|
||||
m_ui->suppressionList->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
|
||||
connect(m_ui->addSuppression, SIGNAL(clicked()),
|
||||
this, SLOT(slotAddSuppression()));
|
||||
connect(m_ui->removeSuppression, SIGNAL(clicked()),
|
||||
this, SLOT(slotRemoveSuppression()));
|
||||
|
||||
m_ui->numCallers->setValue(m_settings->numCallers());
|
||||
connect(m_ui->numCallers, SIGNAL(valueChanged(int)), m_settings, SLOT(setNumCallers(int)));
|
||||
connect(m_settings, SIGNAL(numCallersChanged(int)), m_ui->numCallers, SLOT(setValue(int)));
|
||||
|
||||
m_ui->trackOrigins->setChecked(m_settings->trackOrigins());
|
||||
connect(m_ui->trackOrigins, SIGNAL(toggled(bool)), m_settings, SLOT(setTrackOrigins(bool)));
|
||||
connect(m_settings, SIGNAL(trackOriginsChanged(bool)), m_ui->trackOrigins, SLOT(setChecked(bool)));
|
||||
|
||||
connect(m_settings, SIGNAL(suppressionFilesRemoved(QStringList)),
|
||||
this, SLOT(slotSuppressionsRemoved(QStringList)));
|
||||
connect(m_settings, SIGNAL(suppressionFilesAdded(QStringList)),
|
||||
this, SLOT(slotSuppressionsAdded(QStringList)));
|
||||
|
||||
m_model->clear();
|
||||
foreach (const QString &file, m_settings->suppressionFiles())
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
|
||||
connect(m_ui->suppressionList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(slotSuppressionSelectionChanged()));
|
||||
slotSuppressionSelectionChanged();
|
||||
}
|
||||
|
||||
MemcheckConfigWidget::~MemcheckConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void MemcheckConfigWidget::slotAddSuppression()
|
||||
{
|
||||
QFileDialog dialog;
|
||||
dialog.setNameFilter(tr("Valgrind Suppression File (*.supp);;All Files (*)"));
|
||||
dialog.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
dialog.setFileMode(QFileDialog::ExistingFiles);
|
||||
MemcheckGlobalSettings *conf = Analyzer::AnalyzerGlobalSettings::instance()->subConfig<MemcheckGlobalSettings>();
|
||||
QTC_ASSERT(conf, return);
|
||||
dialog.setDirectory(conf->lastSuppressionDialogDirectory());
|
||||
dialog.setHistory(conf->lastSuppressionDialogHistory());
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
foreach (const QString &file, dialog.selectedFiles())
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
|
||||
m_settings->addSuppressionFiles(dialog.selectedFiles());
|
||||
}
|
||||
|
||||
conf->setLastSuppressionDialogDirectory(dialog.directory().absolutePath());
|
||||
conf->setLastSuppressionDialogHistory(dialog.history());
|
||||
}
|
||||
|
||||
void MemcheckConfigWidget::slotSuppressionsAdded(const QStringList &files)
|
||||
{
|
||||
QStringList filesToAdd = files;
|
||||
for (int i = 0, c = m_model->rowCount(); i < c; ++i)
|
||||
filesToAdd.removeAll(m_model->item(i)->text());
|
||||
|
||||
foreach (const QString &file, filesToAdd)
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
}
|
||||
|
||||
bool sortReverse(int l, int r)
|
||||
{
|
||||
return l > r;
|
||||
}
|
||||
|
||||
void MemcheckConfigWidget::slotRemoveSuppression()
|
||||
{
|
||||
// remove from end so no rows get invalidated
|
||||
QList<int> rows;
|
||||
|
||||
QStringList removed;
|
||||
foreach (const QModelIndex &index, m_ui->suppressionList->selectionModel()->selectedIndexes()) {
|
||||
rows << index.row();
|
||||
removed << index.data().toString();
|
||||
}
|
||||
|
||||
qSort(rows.begin(), rows.end(), sortReverse);
|
||||
|
||||
foreach (int row, rows)
|
||||
m_model->removeRow(row);
|
||||
|
||||
m_settings->removeSuppressionFiles(removed);
|
||||
}
|
||||
|
||||
void MemcheckConfigWidget::slotSuppressionsRemoved(const QStringList &files)
|
||||
{
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
if (files.contains(m_model->item(i)->text())) {
|
||||
m_model->removeRow(i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemcheckConfigWidget::setSuppressions(const QStringList &files)
|
||||
{
|
||||
m_model->clear();
|
||||
foreach (const QString &file, files)
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
}
|
||||
|
||||
QStringList MemcheckConfigWidget::suppressions() const
|
||||
{
|
||||
QStringList ret;
|
||||
|
||||
for (int i = 0; i < m_model->rowCount(); ++i)
|
||||
ret << m_model->item(i)->text();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MemcheckConfigWidget::slotSuppressionSelectionChanged()
|
||||
{
|
||||
m_ui->removeSuppression->setEnabled(m_ui->suppressionList->selectionModel()->hasSelection());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
@@ -1,80 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator Instrumentation Tools
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANALYZER_INTERNAL_MEMCHECKCONFIGWIDGET_H
|
||||
#define ANALYZER_INTERNAL_MEMCHECKCONFIGWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStandardItemModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui {
|
||||
class MemcheckConfigWidget;
|
||||
}
|
||||
|
||||
class AbstractMemcheckSettings;
|
||||
|
||||
class MemcheckConfigWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemcheckConfigWidget(AbstractMemcheckSettings *settings, QWidget *parent);
|
||||
virtual ~MemcheckConfigWidget();
|
||||
|
||||
void setSuppressions(const QStringList &files);
|
||||
QStringList suppressions() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void slotAddSuppression();
|
||||
void slotRemoveSuppression();
|
||||
void slotSuppressionsRemoved(const QStringList &files);
|
||||
void slotSuppressionsAdded(const QStringList &files);
|
||||
void slotSuppressionSelectionChanged();
|
||||
|
||||
private:
|
||||
AbstractMemcheckSettings *m_settings;
|
||||
QStandardItemModel *m_model;
|
||||
Ui::MemcheckConfigWidget *m_ui;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
#endif // ANALYZER_INTERNAL_MEMCHECKCONFIGWIDGET_H
|
||||
@@ -1,130 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Valgrind::Internal::MemcheckConfigWidget</class>
|
||||
<widget class="QWidget" name="Valgrind::Internal::MemcheckConfigWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>416</width>
|
||||
<height>565</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<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_4">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="2" 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="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="4" 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="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>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "memcheckengine.h"
|
||||
|
||||
#include "memchecksettings.h"
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
|
||||
@@ -96,7 +96,7 @@ QStringList MemcheckEngine::toolArguments() const
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("--gen-suppressions=all");
|
||||
|
||||
AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>();
|
||||
ValgrindBaseSettings *memcheckSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
||||
QTC_ASSERT(memcheckSettings, return arguments);
|
||||
|
||||
if (memcheckSettings->trackOrigins())
|
||||
@@ -111,7 +111,7 @@ QStringList MemcheckEngine::toolArguments() const
|
||||
|
||||
QStringList MemcheckEngine::suppressionFiles() const
|
||||
{
|
||||
return m_settings->subConfig<AbstractMemcheckSettings>()->suppressionFiles();
|
||||
return m_settings->subConfig<ValgrindBaseSettings>()->suppressionFiles();
|
||||
}
|
||||
|
||||
void MemcheckEngine::status(const Status &status)
|
||||
|
||||
@@ -1,280 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "memchecksettings.h"
|
||||
#include "memcheckconfigwidget.h"
|
||||
|
||||
#include <valgrind/xmlprotocol/error.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Analyzer;
|
||||
|
||||
static const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
|
||||
static const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
|
||||
static const char suppressionFilesC[] = "Analyzer.Valgrind.SupressionFiles";
|
||||
static const char removedSuppressionFilesC[] = "Analyzer.Valgrind.RemovedSuppressionFiles";
|
||||
static const char addedSuppressionFilesC[] = "Analyzer.Valgrind.AddedSuppressionFiles";
|
||||
static const char filterExternalIssuesC[] = "Analyzer.Valgrind.FilterExternalIssues";
|
||||
static const char visibleErrorKindsC[] = "Analyzer.Valgrind.VisibleErrorKinds";
|
||||
|
||||
static const char lastSuppressionDirectoryC[] = "Analyzer.Valgrind.LastSuppressionDirectory";
|
||||
static const char lastSuppressionHistoryC[] = "Analyzer.Valgrind.LastSuppressionHistory";
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
QVariantMap AbstractMemcheckSettings::defaults() const
|
||||
{
|
||||
QVariantMap map;
|
||||
map.insert(QLatin1String(numCallersC), 25);
|
||||
map.insert(QLatin1String(trackOriginsC), true);
|
||||
map.insert(QLatin1String(filterExternalIssuesC), true);
|
||||
|
||||
QVariantList defaultErrorKinds;
|
||||
for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
|
||||
defaultErrorKinds << i;
|
||||
map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool AbstractMemcheckSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
setIfPresent(map, QLatin1String(numCallersC), &m_numCallers);
|
||||
setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins);
|
||||
setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues);
|
||||
|
||||
// if we get more of these try a template specialization of setIfPresent for lists...
|
||||
if (map.contains(QLatin1String(visibleErrorKindsC))) {
|
||||
m_visibleErrorKinds.clear();
|
||||
foreach (const QVariant &val, map.value(QLatin1String(visibleErrorKindsC)).toList())
|
||||
m_visibleErrorKinds << val.toInt();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap AbstractMemcheckSettings::toMap() const
|
||||
{
|
||||
QVariantMap map;
|
||||
map.insert(QLatin1String(numCallersC), m_numCallers);
|
||||
map.insert(QLatin1String(trackOriginsC), m_trackOrigins);
|
||||
map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues);
|
||||
|
||||
QVariantList errorKinds;
|
||||
foreach (int i, m_visibleErrorKinds)
|
||||
errorKinds << i;
|
||||
map.insert(QLatin1String(visibleErrorKindsC), errorKinds);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void AbstractMemcheckSettings::setNumCallers(int numCallers)
|
||||
{
|
||||
if (m_numCallers != numCallers) {
|
||||
m_numCallers = numCallers;
|
||||
emit numCallersChanged(numCallers);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMemcheckSettings::setTrackOrigins(bool trackOrigins)
|
||||
{
|
||||
if (m_trackOrigins != trackOrigins) {
|
||||
m_trackOrigins = trackOrigins;
|
||||
emit trackOriginsChanged(trackOrigins);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMemcheckSettings::setFilterExternalIssues(bool filterExternalIssues)
|
||||
{
|
||||
if (m_filterExternalIssues != filterExternalIssues) {
|
||||
m_filterExternalIssues = filterExternalIssues;
|
||||
emit filterExternalIssuesChanged(filterExternalIssues);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMemcheckSettings::setVisibleErrorKinds(const QList<int> &visibleErrorKinds)
|
||||
{
|
||||
if (m_visibleErrorKinds != visibleErrorKinds) {
|
||||
m_visibleErrorKinds = visibleErrorKinds;
|
||||
emit visibleErrorKindsChanged(visibleErrorKinds);
|
||||
}
|
||||
}
|
||||
|
||||
QString AbstractMemcheckSettings::id() const
|
||||
{
|
||||
return "Analyzer.Valgrind.Settings.Memcheck";
|
||||
}
|
||||
|
||||
QString AbstractMemcheckSettings::displayName() const
|
||||
{
|
||||
return tr("Memory Analysis");
|
||||
}
|
||||
|
||||
QWidget *AbstractMemcheckSettings::createConfigWidget(QWidget *parent)
|
||||
{
|
||||
return new MemcheckConfigWidget(this, parent);
|
||||
}
|
||||
|
||||
QStringList MemcheckGlobalSettings::suppressionFiles() const
|
||||
{
|
||||
return m_suppressionFiles;
|
||||
}
|
||||
|
||||
void MemcheckGlobalSettings::addSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
foreach (const QString &s, suppressions)
|
||||
if (!m_suppressionFiles.contains(s))
|
||||
m_suppressionFiles.append(s);
|
||||
}
|
||||
|
||||
void MemcheckGlobalSettings::removeSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
foreach (const QString &s, suppressions)
|
||||
m_suppressionFiles.removeAll(s);
|
||||
}
|
||||
|
||||
QString MemcheckGlobalSettings::lastSuppressionDialogDirectory() const
|
||||
{
|
||||
return m_lastSuppressionDirectory;
|
||||
}
|
||||
|
||||
void MemcheckGlobalSettings::setLastSuppressionDialogDirectory(const QString &directory)
|
||||
{
|
||||
m_lastSuppressionDirectory = directory;
|
||||
}
|
||||
|
||||
QStringList MemcheckGlobalSettings::lastSuppressionDialogHistory() const
|
||||
{
|
||||
return m_lastSuppressionHistory;
|
||||
}
|
||||
|
||||
void MemcheckGlobalSettings::setLastSuppressionDialogHistory(const QStringList &history)
|
||||
{
|
||||
m_lastSuppressionHistory = history;
|
||||
}
|
||||
|
||||
QVariantMap MemcheckGlobalSettings::defaults() const
|
||||
{
|
||||
QVariantMap ret = AbstractMemcheckSettings::defaults();
|
||||
ret.insert(suppressionFilesC, QStringList());
|
||||
ret.insert(lastSuppressionDirectoryC, QString());
|
||||
ret.insert(lastSuppressionHistoryC, QStringList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool MemcheckGlobalSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
AbstractMemcheckSettings::fromMap(map);
|
||||
m_suppressionFiles = map.value(suppressionFilesC).toStringList();
|
||||
m_lastSuppressionDirectory = map.value(lastSuppressionDirectoryC).toString();
|
||||
m_lastSuppressionHistory = map.value(lastSuppressionHistoryC).toStringList();
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap MemcheckGlobalSettings::toMap() const
|
||||
{
|
||||
QVariantMap map = AbstractMemcheckSettings::toMap();
|
||||
map.insert(suppressionFilesC, m_suppressionFiles);
|
||||
map.insert(lastSuppressionDirectoryC, m_lastSuppressionDirectory);
|
||||
map.insert(lastSuppressionHistoryC, m_lastSuppressionHistory);
|
||||
return map;
|
||||
}
|
||||
|
||||
MemcheckGlobalSettings *globalMemcheckSettings()
|
||||
{
|
||||
MemcheckGlobalSettings *ret = AnalyzerGlobalSettings::instance()->subConfig<MemcheckGlobalSettings>();
|
||||
QTC_ASSERT(ret, return 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap MemcheckProjectSettings::defaults() const
|
||||
{
|
||||
QVariantMap ret = AbstractMemcheckSettings::defaults();
|
||||
ret.insert(addedSuppressionFilesC, QStringList());
|
||||
ret.insert(removedSuppressionFilesC, QStringList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool MemcheckProjectSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
AbstractMemcheckSettings::fromMap(map);
|
||||
setIfPresent(map, addedSuppressionFilesC, &m_addedSuppressionFiles);
|
||||
setIfPresent(map, removedSuppressionFilesC, &m_disabledGlobalSuppressionFiles);
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap MemcheckProjectSettings::toMap() const
|
||||
{
|
||||
QVariantMap map = AbstractMemcheckSettings::toMap();
|
||||
map.insert(addedSuppressionFilesC, m_addedSuppressionFiles);
|
||||
map.insert(removedSuppressionFilesC, m_disabledGlobalSuppressionFiles);
|
||||
return map;
|
||||
}
|
||||
|
||||
void MemcheckProjectSettings::addSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
QStringList globalSuppressions = globalMemcheckSettings()->suppressionFiles();
|
||||
foreach (const QString &s, suppressions) {
|
||||
if (m_addedSuppressionFiles.contains(s))
|
||||
continue;
|
||||
m_disabledGlobalSuppressionFiles.removeAll(s);
|
||||
if (!globalSuppressions.contains(s))
|
||||
m_addedSuppressionFiles.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
void MemcheckProjectSettings::removeSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
QStringList globalSuppressions = globalMemcheckSettings()->suppressionFiles();
|
||||
foreach (const QString &s, suppressions) {
|
||||
m_addedSuppressionFiles.removeAll(s);
|
||||
if (globalSuppressions.contains(s))
|
||||
m_disabledGlobalSuppressionFiles.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList MemcheckProjectSettings::suppressionFiles() const
|
||||
{
|
||||
QStringList ret = globalMemcheckSettings()->suppressionFiles();
|
||||
foreach (const QString &s, m_disabledGlobalSuppressionFiles)
|
||||
ret.removeAll(s);
|
||||
ret.append(m_addedSuppressionFiles);
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
@@ -1,152 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANALYZER_INTERNAL_MEMCHECKSETTINGS_H
|
||||
#define ANALYZER_INTERNAL_MEMCHECKSETTINGS_H
|
||||
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
/**
|
||||
* Generic memcheck settings
|
||||
*/
|
||||
class AbstractMemcheckSettings : public Analyzer::AbstractAnalyzerSubConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AbstractMemcheckSettings() {}
|
||||
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
int numCallers() const { return m_numCallers; }
|
||||
bool trackOrigins() const { return m_trackOrigins; }
|
||||
bool filterExternalIssues() const { return m_filterExternalIssues; }
|
||||
QList<int> visibleErrorKinds() const { return m_visibleErrorKinds; }
|
||||
|
||||
virtual QStringList suppressionFiles() const = 0;
|
||||
virtual void addSuppressionFiles(const QStringList &) = 0;
|
||||
virtual void removeSuppressionFiles(const QStringList &) = 0;
|
||||
|
||||
virtual QVariantMap defaults() const;
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QWidget *createConfigWidget(QWidget *parent);
|
||||
|
||||
public slots:
|
||||
void setNumCallers(int);
|
||||
void setTrackOrigins(bool);
|
||||
void setFilterExternalIssues(bool);
|
||||
void setVisibleErrorKinds(const QList<int> &);
|
||||
|
||||
signals:
|
||||
void numCallersChanged(int);
|
||||
void trackOriginsChanged(bool);
|
||||
void filterExternalIssuesChanged(bool);
|
||||
void visibleErrorKindsChanged(const QList<int> &);
|
||||
void suppressionFilesRemoved(const QStringList &);
|
||||
void suppressionFilesAdded(const QStringList &);
|
||||
|
||||
protected:
|
||||
virtual QVariantMap toMap() const;
|
||||
|
||||
int m_numCallers;
|
||||
bool m_trackOrigins;
|
||||
bool m_filterExternalIssues;
|
||||
QList<int> m_visibleErrorKinds;
|
||||
};
|
||||
|
||||
/**
|
||||
* Global memcheck settings
|
||||
*/
|
||||
class MemcheckGlobalSettings : public AbstractMemcheckSettings
|
||||
{
|
||||
public:
|
||||
MemcheckGlobalSettings() {}
|
||||
|
||||
QStringList suppressionFiles() const;
|
||||
// in the global settings we change the internal list directly
|
||||
void addSuppressionFiles(const QStringList &);
|
||||
void removeSuppressionFiles(const QStringList &);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
QVariantMap defaults() const;
|
||||
|
||||
// internal settings which don't require any UI
|
||||
void setLastSuppressionDialogDirectory(const QString &directory);
|
||||
QString lastSuppressionDialogDirectory() const;
|
||||
|
||||
void setLastSuppressionDialogHistory(const QStringList &history);
|
||||
QStringList lastSuppressionDialogHistory() const;
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
QStringList m_suppressionFiles;
|
||||
QString m_lastSuppressionDirectory;
|
||||
QStringList m_lastSuppressionHistory;
|
||||
};
|
||||
|
||||
/**
|
||||
* Per-project memcheck settings, saves a diff to the global suppression files list
|
||||
*/
|
||||
class MemcheckProjectSettings : public AbstractMemcheckSettings
|
||||
{
|
||||
public:
|
||||
MemcheckProjectSettings() {}
|
||||
|
||||
QStringList suppressionFiles() const;
|
||||
// in the project-specific settings we store a diff to the global list
|
||||
void addSuppressionFiles(const QStringList &suppressions);
|
||||
void removeSuppressionFiles(const QStringList &suppressions);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
QVariantMap defaults() const;
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
QStringList m_disabledGlobalSuppressionFiles;
|
||||
QStringList m_addedSuppressionFiles;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
#endif // ANALYZER_INTERNAL_MEMCHECKSETTINGS_H
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "memchecktool.h"
|
||||
#include "memcheckengine.h"
|
||||
#include "memcheckerrorview.h"
|
||||
#include "memchecksettings.h"
|
||||
#include "valgrindsettings.h"
|
||||
#include "valgrindplugin.h"
|
||||
|
||||
@@ -260,7 +259,7 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
|
||||
|
||||
connect(m_settings, SIGNAL(destroyed(QObject *)), SLOT(settingsDestroyed(QObject *)));
|
||||
|
||||
AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>();
|
||||
ValgrindBaseSettings *memcheckSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
||||
QTC_ASSERT(memcheckSettings, return);
|
||||
|
||||
foreach (QAction *action, m_errorFilterActions) {
|
||||
@@ -288,12 +287,12 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
|
||||
|
||||
QByteArray MemcheckTool::id() const
|
||||
{
|
||||
return "MemcheckLocal";
|
||||
return "Memcheck";
|
||||
}
|
||||
|
||||
QString MemcheckTool::displayName() const
|
||||
{
|
||||
return tr("Valgrind Analyze Memory");
|
||||
return tr("Valgrind Memory Analyzer");
|
||||
}
|
||||
|
||||
QString MemcheckTool::description() const
|
||||
@@ -524,7 +523,7 @@ void MemcheckTool::updateErrorFilter()
|
||||
QTC_ASSERT(m_errorView, return);
|
||||
QTC_ASSERT(m_settings, return);
|
||||
|
||||
AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>();
|
||||
ValgrindBaseSettings *memcheckSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
||||
QTC_ASSERT(memcheckSettings, return);
|
||||
memcheckSettings->setFilterExternalIssues(!m_filterProjectAction->isChecked());
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "ui_suppressiondialog.h"
|
||||
|
||||
#include "memcheckerrorview.h"
|
||||
#include "memchecksettings.h"
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/session.h>
|
||||
@@ -206,7 +206,7 @@ void SuppressionDialog::accept()
|
||||
}
|
||||
}
|
||||
|
||||
m_settings->subConfig<AbstractMemcheckSettings>()->addSuppressionFiles(QStringList(path));
|
||||
m_settings->subConfig<ValgrindBaseSettings>()->addSuppressionFiles(QStringList(path));
|
||||
|
||||
QModelIndexList indizes = m_view->selectionModel()->selectedRows();
|
||||
qSort(indizes.begin(), indizes.end(), sortIndizesReverse);
|
||||
|
||||
@@ -13,12 +13,10 @@ HEADERS += \
|
||||
valgrindengine.h \
|
||||
valgrindconfigwidget.h \
|
||||
valgrindsettings.h \
|
||||
callgrindconfigwidget.h \
|
||||
callgrindcostdelegate.h \
|
||||
callgrindcostview.h \
|
||||
callgrindhelper.h \
|
||||
callgrindnamedelegate.h \
|
||||
callgrindsettings.h \
|
||||
callgrindtool.h \
|
||||
callgrindvisualisation.h \
|
||||
callgrindengine.h \
|
||||
@@ -28,8 +26,6 @@ HEADERS += \
|
||||
memchecktool.h \
|
||||
memcheckengine.h \
|
||||
memcheckerrorview.h \
|
||||
memchecksettings.h \
|
||||
memcheckconfigwidget.h \
|
||||
suppressiondialog.h
|
||||
|
||||
SOURCES += \
|
||||
@@ -38,12 +34,10 @@ SOURCES += \
|
||||
valgrindconfigwidget.cpp \
|
||||
valgrindsettings.cpp \
|
||||
\
|
||||
callgrindconfigwidget.cpp \
|
||||
callgrindcostdelegate.cpp \
|
||||
callgrindcostview.cpp \
|
||||
callgrindhelper.cpp \
|
||||
callgrindnamedelegate.cpp \
|
||||
callgrindsettings.cpp \
|
||||
callgrindtool.cpp \
|
||||
callgrindvisualisation.cpp \
|
||||
callgrindengine.cpp \
|
||||
@@ -52,13 +46,9 @@ SOURCES += \
|
||||
memchecktool.cpp \
|
||||
memcheckengine.cpp \
|
||||
memcheckerrorview.cpp \
|
||||
memchecksettings.cpp \
|
||||
memcheckconfigwidget.cpp \
|
||||
suppressiondialog.cpp
|
||||
|
||||
FORMS += \
|
||||
valgrindconfigwidget.ui \
|
||||
callgrindconfigwidget.ui \
|
||||
suppressiondialog.ui \
|
||||
memcheckconfigwidget.ui
|
||||
suppressiondialog.ui
|
||||
|
||||
|
||||
@@ -33,16 +33,22 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "valgrindconfigwidget.h"
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include "ui_valgrindconfigwidget.h"
|
||||
|
||||
#include "valgrindsettings.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
using namespace Valgrind::Internal;
|
||||
#include <QtGui/QStandardItemModel>
|
||||
#include <QtGui/QFileDialog>
|
||||
|
||||
ValgrindConfigWidget::ValgrindConfigWidget(ValgrindSettings *settings, QWidget *parent)
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
|
||||
QWidget *parent, bool global)
|
||||
: QWidget(parent),
|
||||
m_settings(settings),
|
||||
m_ui(new Ui::ValgrindConfigWidget)
|
||||
@@ -53,11 +59,196 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindSettings *settings, QWidget *
|
||||
m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command"));
|
||||
|
||||
m_ui->valgrindExeChooser->setPath(m_settings->valgrindExecutable());
|
||||
connect(m_ui->valgrindExeChooser, SIGNAL(changed(QString)), m_settings, SLOT(setValgrindExecutable(QString)));
|
||||
connect(m_settings, SIGNAL(valgrindExecutableChanged(QString)), m_ui->valgrindExeChooser, SLOT(setPath(QString)));
|
||||
connect(m_ui->valgrindExeChooser, SIGNAL(changed(QString)),
|
||||
m_settings, SLOT(setValgrindExecutable(QString)));
|
||||
connect(m_settings, SIGNAL(valgrindExecutableChanged(QString)),
|
||||
m_ui->valgrindExeChooser, SLOT(setPath(QString)));
|
||||
|
||||
//
|
||||
// Callgrind
|
||||
//
|
||||
m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim());
|
||||
connect(m_ui->enableCacheSim, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setEnableCacheSim(bool)));
|
||||
connect(m_settings, SIGNAL(enableCacheSimChanged(bool)),
|
||||
m_ui->enableCacheSim, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->enableBranchSim->setChecked(m_settings->enableBranchSim());
|
||||
connect(m_ui->enableBranchSim, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setEnableBranchSim(bool)));
|
||||
connect(m_settings, SIGNAL(enableBranchSimChanged(bool)),
|
||||
m_ui->enableBranchSim, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->collectSystime->setChecked(m_settings->collectSystime());
|
||||
connect(m_ui->collectSystime, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setCollectSystime(bool)));
|
||||
connect(m_settings, SIGNAL(collectSystimeChanged(bool)),
|
||||
m_ui->collectSystime, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->collectBusEvents->setChecked(m_settings->collectBusEvents());
|
||||
connect(m_ui->collectBusEvents, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setCollectBusEvents(bool)));
|
||||
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
|
||||
m_ui->collectBusEvents, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->enableEventToolTips->setChecked(m_settings->enableEventToolTips());
|
||||
connect(m_ui->enableEventToolTips, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setEnableEventToolTips(bool)));
|
||||
connect(m_settings, SIGNAL(enableEventToolTipsChanged(bool)),
|
||||
m_ui->enableEventToolTips, SLOT(setChecked(bool)));
|
||||
|
||||
m_ui->minimumInclusiveCostRatio->setValue(m_settings->minimumInclusiveCostRatio());
|
||||
connect(m_ui->minimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
||||
m_settings, SLOT(setMinimumInclusiveCostRatio(double)));
|
||||
connect(m_settings, SIGNAL(minimumInclusiveCostRatioChanged(double)),
|
||||
m_ui->minimumInclusiveCostRatio, SLOT(setValue(double)));
|
||||
|
||||
m_ui->visualisationMinimumInclusiveCostRatio->setValue(m_settings->visualisationMinimumInclusiveCostRatio());
|
||||
connect(m_ui->visualisationMinimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
||||
m_settings, SLOT(setVisualisationMinimumInclusiveCostRatio(double)));
|
||||
connect(m_settings, SIGNAL(visualisationMinimumInclusiveCostRatioChanged(double)),
|
||||
m_ui->visualisationMinimumInclusiveCostRatio, SLOT(setValue(double)));
|
||||
|
||||
//
|
||||
// Memcheck
|
||||
//
|
||||
m_model = new QStandardItemModel(this);
|
||||
|
||||
m_ui->suppressionList->setModel(m_model);
|
||||
m_ui->suppressionList->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
|
||||
connect(m_ui->addSuppression, SIGNAL(clicked()),
|
||||
this, SLOT(slotAddSuppression()));
|
||||
connect(m_ui->removeSuppression, SIGNAL(clicked()),
|
||||
this, SLOT(slotRemoveSuppression()));
|
||||
|
||||
m_ui->numCallers->setValue(m_settings->numCallers());
|
||||
connect(m_ui->numCallers, SIGNAL(valueChanged(int)), m_settings, SLOT(setNumCallers(int)));
|
||||
connect(m_settings, SIGNAL(numCallersChanged(int)), m_ui->numCallers, SLOT(setValue(int)));
|
||||
|
||||
m_ui->trackOrigins->setChecked(m_settings->trackOrigins());
|
||||
connect(m_ui->trackOrigins, SIGNAL(toggled(bool)),
|
||||
m_settings, SLOT(setTrackOrigins(bool)));
|
||||
connect(m_settings, SIGNAL(trackOriginsChanged(bool)),
|
||||
m_ui->trackOrigins, SLOT(setChecked(bool)));
|
||||
|
||||
connect(m_settings, SIGNAL(suppressionFilesRemoved(QStringList)),
|
||||
this, SLOT(slotSuppressionsRemoved(QStringList)));
|
||||
connect(m_settings, SIGNAL(suppressionFilesAdded(QStringList)),
|
||||
this, SLOT(slotSuppressionsAdded(QStringList)));
|
||||
|
||||
m_model->clear();
|
||||
foreach (const QString &file, m_settings->suppressionFiles())
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
|
||||
connect(m_ui->suppressionList->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(slotSuppressionSelectionChanged()));
|
||||
slotSuppressionSelectionChanged();
|
||||
|
||||
if (!global) {
|
||||
// In project settings we want a flat vertical list.
|
||||
QVBoxLayout *l = new QVBoxLayout;
|
||||
while (layout()->count())
|
||||
if (QWidget *w = layout()->takeAt(0)->widget())
|
||||
l->addWidget(w);
|
||||
delete layout();
|
||||
setLayout(l);
|
||||
}
|
||||
}
|
||||
|
||||
ValgrindConfigWidget::~ValgrindConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ValgrindConfigWidget::slotAddSuppression()
|
||||
{
|
||||
QFileDialog dialog;
|
||||
dialog.setNameFilter(tr("Valgrind Suppression File (*.supp);;All Files (*)"));
|
||||
dialog.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
dialog.setFileMode(QFileDialog::ExistingFiles);
|
||||
ValgrindGlobalSettings *conf = Analyzer::AnalyzerGlobalSettings::instance()->subConfig<ValgrindGlobalSettings>();
|
||||
QTC_ASSERT(conf, return);
|
||||
dialog.setDirectory(conf->lastSuppressionDialogDirectory());
|
||||
dialog.setHistory(conf->lastSuppressionDialogHistory());
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
foreach (const QString &file, dialog.selectedFiles())
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
|
||||
m_settings->addSuppressionFiles(dialog.selectedFiles());
|
||||
}
|
||||
|
||||
conf->setLastSuppressionDialogDirectory(dialog.directory().absolutePath());
|
||||
conf->setLastSuppressionDialogHistory(dialog.history());
|
||||
}
|
||||
|
||||
void ValgrindConfigWidget::slotSuppressionsAdded(const QStringList &files)
|
||||
{
|
||||
QStringList filesToAdd = files;
|
||||
for (int i = 0, c = m_model->rowCount(); i < c; ++i)
|
||||
filesToAdd.removeAll(m_model->item(i)->text());
|
||||
|
||||
foreach (const QString &file, filesToAdd)
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
}
|
||||
|
||||
bool sortReverse(int l, int r)
|
||||
{
|
||||
return l > r;
|
||||
}
|
||||
|
||||
void ValgrindConfigWidget::slotRemoveSuppression()
|
||||
{
|
||||
// remove from end so no rows get invalidated
|
||||
QList<int> rows;
|
||||
|
||||
QStringList removed;
|
||||
foreach (const QModelIndex &index, m_ui->suppressionList->selectionModel()->selectedIndexes()) {
|
||||
rows << index.row();
|
||||
removed << index.data().toString();
|
||||
}
|
||||
|
||||
qSort(rows.begin(), rows.end(), sortReverse);
|
||||
|
||||
foreach (int row, rows)
|
||||
m_model->removeRow(row);
|
||||
|
||||
m_settings->removeSuppressionFiles(removed);
|
||||
}
|
||||
|
||||
void ValgrindConfigWidget::slotSuppressionsRemoved(const QStringList &files)
|
||||
{
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
if (files.contains(m_model->item(i)->text())) {
|
||||
m_model->removeRow(i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindConfigWidget::setSuppressions(const QStringList &files)
|
||||
{
|
||||
m_model->clear();
|
||||
foreach (const QString &file, files)
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
}
|
||||
|
||||
QStringList ValgrindConfigWidget::suppressions() const
|
||||
{
|
||||
QStringList ret;
|
||||
|
||||
for (int i = 0; i < m_model->rowCount(); ++i)
|
||||
ret << m_model->item(i)->text();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ValgrindConfigWidget::slotSuppressionSelectionChanged()
|
||||
{
|
||||
m_ui->removeSuppression->setEnabled(m_ui->suppressionList->selectionModel()->hasSelection());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
@@ -32,12 +32,15 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H
|
||||
#define ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H
|
||||
#ifndef ANALYZER_VALGRINDCONFIGWIDGET_H
|
||||
#define ANALYZER_VALGRINDCONFIGWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStandardItemModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
@@ -45,22 +48,33 @@ namespace Ui {
|
||||
class ValgrindConfigWidget;
|
||||
}
|
||||
|
||||
class ValgrindSettings;
|
||||
class ValgrindBaseSettings;
|
||||
|
||||
class ValgrindConfigWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ValgrindConfigWidget(ValgrindSettings *settings, QWidget *parent);
|
||||
ValgrindConfigWidget(ValgrindBaseSettings *settings, QWidget *parent, bool global);
|
||||
virtual ~ValgrindConfigWidget();
|
||||
|
||||
void setSuppressions(const QStringList &files);
|
||||
QStringList suppressions() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void slotAddSuppression();
|
||||
void slotRemoveSuppression();
|
||||
void slotSuppressionsRemoved(const QStringList &files);
|
||||
void slotSuppressionsAdded(const QStringList &files);
|
||||
void slotSuppressionSelectionChanged();
|
||||
|
||||
private:
|
||||
ValgrindSettings *m_settings;
|
||||
ValgrindBaseSettings *m_settings;
|
||||
Ui::ValgrindConfigWidget *m_ui;
|
||||
QStandardItemModel *m_model;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
#endif // ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H
|
||||
#endif // ANALYZER_VALGRINDCONFIGWIDGET_H
|
||||
|
||||
@@ -6,39 +6,322 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>543</height>
|
||||
<width>669</width>
|
||||
<height>312</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="commonValgrindOptions">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Generic Settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<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"/>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="valgrindExeChooser">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>197</width>
|
||||
<height>1</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_4">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="2" 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="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="4" 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="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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QGroupBox" name="memcheckOptions_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Profiling Options</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" 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>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Result view: Minimum event cost:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>minimumInclusiveCostRatio</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="minimumInclusiveCostRatio">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="enableEventToolTips">
|
||||
<property name="title">
|
||||
<string>Show additional information for events in tooltips</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="enableCacheSim">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body>
|
||||
<p>Does full cache simulation.</p>
|
||||
<p>By default, only instruction read accesses will be counted ("Ir").</p>
|
||||
<p>
|
||||
With cache simulation, further event counters are enabled:
|
||||
<ul><li>Cache misses on instruction reads ("I1mr"/"I2mr")</li>
|
||||
<li>Data read accesses ("Dr") and related cache misses ("D1mr"/"D2mr")</li>
|
||||
<li>Data write accesses ("Dw") and related cache misses ("D1mw"/"D2mw")</li></ul>
|
||||
</p>
|
||||
|
||||
</body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable cache simulation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="enableBranchSim">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body>
|
||||
<p>Do branch prediction simulation.</p>
|
||||
<p>Further event counters are enabled: </p>
|
||||
<ul><li>Number of executed conditional branches and related predictor misses (
|
||||
"Bc"/"Bcm")</li>
|
||||
<li>Executed indirect jumps and related misses of the jump address predictor (
|
||||
"Bi"/"Bim")</li></ul></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable branch prediction simulation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="collectSystime">
|
||||
<property name="toolTip">
|
||||
<string>Collect information for system call times.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Collect system call time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="collectBusEvents">
|
||||
<property name="toolTip">
|
||||
<string>Collect the number of global bus events that are executed. The event type "Ge" is used for these events.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Collect global bus events</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="visualisationMinimumInclusiveCostRatioLabel">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Visualisation: Minimum event cost:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio">
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>50.000000000000000</double>
|
||||
</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>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -95,7 +95,7 @@ void ValgrindEngine::start()
|
||||
|
||||
const AnalyzerStartParameters &sp = startParameters();
|
||||
runner()->setWorkingDirectory(sp.workingDirectory);
|
||||
QString valgrindExe = m_settings->subConfig<ValgrindSettings>()->valgrindExecutable();
|
||||
QString valgrindExe = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
|
||||
if (!sp.analyzerCmdPrefix.isEmpty())
|
||||
valgrindExe = sp.analyzerCmdPrefix + ' ' + valgrindExe;
|
||||
runner()->setValgrindExecutable(valgrindExe);
|
||||
@@ -159,7 +159,7 @@ void ValgrindEngine::receiveProcessOutput(const QByteArray &b, Utils::OutputForm
|
||||
void ValgrindEngine::receiveProcessError(const QString &error, QProcess::ProcessError e)
|
||||
{
|
||||
if (e == QProcess::FailedToStart) {
|
||||
const QString &valgrind = m_settings->subConfig<ValgrindSettings>()->valgrindExecutable();
|
||||
const QString &valgrind = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
|
||||
if (!valgrind.isEmpty()) {
|
||||
emit outputReceived(tr("** Error: \"%1\" could not be started: %2 **\n").arg(valgrind).arg(error), Utils::ErrorMessageFormat);
|
||||
} else {
|
||||
|
||||
@@ -34,9 +34,7 @@
|
||||
|
||||
#include "valgrindplugin.h"
|
||||
|
||||
#include "callgrindsettings.h"
|
||||
#include "callgrindtool.h"
|
||||
#include "memchecksettings.h"
|
||||
#include "memchecktool.h"
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
@@ -44,7 +42,6 @@
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzerrunconfigwidget.h>
|
||||
#include <analyzerbase/analyzerruncontrol.h>
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
#include <analyzerbase/analyzerstartparameters.h>
|
||||
#include <analyzerbase/startremotedialog.h>
|
||||
|
||||
@@ -199,36 +196,19 @@ void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode)
|
||||
startRemoteTool(tool, mode);
|
||||
}
|
||||
|
||||
static AbstractAnalyzerSubConfig *valgrindConfigFactory()
|
||||
static AbstractAnalyzerSubConfig *globalValgrindFactory()
|
||||
{
|
||||
return new ValgrindSettings();
|
||||
return new ValgrindGlobalSettings();
|
||||
}
|
||||
|
||||
static AbstractAnalyzerSubConfig *globalCallgrindFactory()
|
||||
static AbstractAnalyzerSubConfig *projectValgrindFactory()
|
||||
{
|
||||
return new CallgrindGlobalSettings();
|
||||
}
|
||||
|
||||
static AbstractAnalyzerSubConfig *projectCallgrindFactory()
|
||||
{
|
||||
return new CallgrindProjectSettings();
|
||||
}
|
||||
|
||||
static AbstractAnalyzerSubConfig *globalMemcheckFactory()
|
||||
{
|
||||
return new MemcheckGlobalSettings();
|
||||
}
|
||||
|
||||
static AbstractAnalyzerSubConfig *projectMemcheckFactory()
|
||||
{
|
||||
return new MemcheckProjectSettings();
|
||||
return new ValgrindProjectSettings();
|
||||
}
|
||||
|
||||
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
{
|
||||
AnalyzerGlobalSettings::instance()->registerSubConfigs(&valgrindConfigFactory, &valgrindConfigFactory);
|
||||
AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalCallgrindFactory, &projectCallgrindFactory);
|
||||
AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalMemcheckFactory, &projectMemcheckFactory);
|
||||
AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalValgrindFactory, &projectValgrindFactory);
|
||||
|
||||
StartModes modes;
|
||||
#ifndef Q_OS_WIN
|
||||
|
||||
@@ -33,43 +33,136 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include "valgrindconfigwidget.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <valgrind/xmlprotocol/error.h>
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
|
||||
using namespace Valgrind::Internal;
|
||||
using namespace Analyzer;
|
||||
|
||||
static const QLatin1String groupC("Analyzer");
|
||||
static const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
|
||||
static const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
|
||||
static const char suppressionFilesC[] = "Analyzer.Valgrind.SupressionFiles";
|
||||
static const char removedSuppressionFilesC[] = "Analyzer.Valgrind.RemovedSuppressionFiles";
|
||||
static const char addedSuppressionFilesC[] = "Analyzer.Valgrind.AddedSuppressionFiles";
|
||||
static const char filterExternalIssuesC[] = "Analyzer.Valgrind.FilterExternalIssues";
|
||||
static const char visibleErrorKindsC[] = "Analyzer.Valgrind.VisibleErrorKinds";
|
||||
|
||||
static const QLatin1String valgrindExeC("Analyzer.Valgrind.ValgrindExecutable");
|
||||
static const char lastSuppressionDirectoryC[] = "Analyzer.Valgrind.LastSuppressionDirectory";
|
||||
static const char lastSuppressionHistoryC[] = "Analyzer.Valgrind.LastSuppressionHistory";
|
||||
|
||||
QVariantMap ValgrindSettings::defaults() const
|
||||
static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.EnableCacheSim";
|
||||
static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
|
||||
static const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
|
||||
static const char callgrindCollectBusEventsC[] = "Analyzer.Valgrind.Callgrind.CollectBusEvents";
|
||||
static const char callgrindEnableEventToolTipsC[] = "Analyzer.Valgrind.Callgrind.EnableEventToolTips";
|
||||
static const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
|
||||
static const char callgrindVisualisationMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio";
|
||||
|
||||
static const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
|
||||
static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
|
||||
|
||||
static const char valgrindExeC[] = "Analyzer.Valgrind.ValgrindExecutable";
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ValgrindBaseSettings
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
QVariantMap ValgrindBaseSettings::defaults() const
|
||||
{
|
||||
QVariantMap map;
|
||||
map.insert(valgrindExeC, QLatin1String("valgrind"));
|
||||
|
||||
// General
|
||||
map.insert(QLatin1String(valgrindExeC), QLatin1String("valgrind"));
|
||||
|
||||
// Memcheck
|
||||
map.insert(QLatin1String(numCallersC), 25);
|
||||
map.insert(QLatin1String(trackOriginsC), true);
|
||||
map.insert(QLatin1String(filterExternalIssuesC), true);
|
||||
QVariantList defaultErrorKinds;
|
||||
for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
|
||||
defaultErrorKinds << i;
|
||||
map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindEnableCacheSimC), false);
|
||||
map.insert(QLatin1String(callgrindEnableBranchSimC), false);
|
||||
map.insert(QLatin1String(callgrindCollectSystimeC), false);
|
||||
map.insert(QLatin1String(callgrindCollectBusEventsC), false);
|
||||
map.insert(QLatin1String(callgrindEnableEventToolTipsC), true);
|
||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.01);
|
||||
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), 10.0);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool ValgrindSettings::fromMap(const QVariantMap &map)
|
||||
bool ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
setIfPresent(map, valgrindExeC, &m_valgrindExecutable);
|
||||
// General
|
||||
setIfPresent(map, QLatin1String(valgrindExeC), &m_valgrindExecutable);
|
||||
|
||||
// Memcheck
|
||||
setIfPresent(map, QLatin1String(numCallersC), &m_numCallers);
|
||||
setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins);
|
||||
setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues);
|
||||
if (map.contains(QLatin1String(visibleErrorKindsC))) {
|
||||
m_visibleErrorKinds.clear();
|
||||
foreach (const QVariant &val, map.value(QLatin1String(visibleErrorKindsC)).toList())
|
||||
m_visibleErrorKinds << val.toInt();
|
||||
}
|
||||
|
||||
// Callgrind
|
||||
setIfPresent(map, QLatin1String(callgrindEnableCacheSimC), &m_enableCacheSim);
|
||||
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
|
||||
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
|
||||
setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents);
|
||||
setIfPresent(map, QLatin1String(callgrindEnableEventToolTipsC), &m_enableEventToolTips);
|
||||
setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
|
||||
setIfPresent(map, QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
||||
&m_visualisationMinimumInclusiveCostRatio);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap ValgrindSettings::toMap() const
|
||||
QVariantMap ValgrindBaseSettings::toMap() const
|
||||
{
|
||||
QVariantMap map;
|
||||
map.insert(valgrindExeC, m_valgrindExecutable);
|
||||
|
||||
// General
|
||||
map.insert(QLatin1String(valgrindExeC), m_valgrindExecutable);
|
||||
|
||||
// Memcheck
|
||||
map.insert(QLatin1String(numCallersC), m_numCallers);
|
||||
map.insert(QLatin1String(trackOriginsC), m_trackOrigins);
|
||||
map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues);
|
||||
QVariantList errorKinds;
|
||||
foreach (int i, m_visibleErrorKinds)
|
||||
errorKinds << i;
|
||||
map.insert(QLatin1String(visibleErrorKindsC), errorKinds);
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindEnableCacheSimC), m_enableCacheSim);
|
||||
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
|
||||
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
|
||||
map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents);
|
||||
map.insert(QLatin1String(callgrindEnableEventToolTipsC), m_enableEventToolTips);
|
||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
|
||||
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
||||
m_visualisationMinimumInclusiveCostRatio);
|
||||
return map;
|
||||
}
|
||||
|
||||
void ValgrindSettings::setValgrindExecutable(const QString &valgrindExecutable)
|
||||
void ValgrindBaseSettings::setValgrindExecutable(const QString &valgrindExecutable)
|
||||
{
|
||||
if (m_valgrindExecutable != valgrindExecutable) {
|
||||
m_valgrindExecutable = valgrindExecutable;
|
||||
@@ -77,22 +170,332 @@ void ValgrindSettings::setValgrindExecutable(const QString &valgrindExecutable)
|
||||
}
|
||||
}
|
||||
|
||||
QString ValgrindSettings::valgrindExecutable() const
|
||||
QString ValgrindBaseSettings::valgrindExecutable() const
|
||||
{
|
||||
return m_valgrindExecutable;
|
||||
}
|
||||
|
||||
QString ValgrindSettings::id() const
|
||||
QString ValgrindBaseSettings::id() const
|
||||
{
|
||||
return "Analyzer.Valgrind.Settings.Generic";
|
||||
return "Analyzer.Valgrind.Settings";
|
||||
}
|
||||
|
||||
QString ValgrindSettings::displayName() const
|
||||
QString ValgrindBaseSettings::displayName() const
|
||||
{
|
||||
return tr("Generic Settings");
|
||||
return tr("Valgrind");
|
||||
}
|
||||
|
||||
QWidget *ValgrindSettings::createConfigWidget(QWidget *parent)
|
||||
void ValgrindBaseSettings::setNumCallers(int numCallers)
|
||||
{
|
||||
return new ValgrindConfigWidget(this, parent);
|
||||
if (m_numCallers != numCallers) {
|
||||
m_numCallers = numCallers;
|
||||
emit numCallersChanged(numCallers);
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setTrackOrigins(bool trackOrigins)
|
||||
{
|
||||
if (m_trackOrigins != trackOrigins) {
|
||||
m_trackOrigins = trackOrigins;
|
||||
emit trackOriginsChanged(trackOrigins);
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setFilterExternalIssues(bool filterExternalIssues)
|
||||
{
|
||||
if (m_filterExternalIssues != filterExternalIssues) {
|
||||
m_filterExternalIssues = filterExternalIssues;
|
||||
emit filterExternalIssuesChanged(filterExternalIssues);
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setVisibleErrorKinds(const QList<int> &visibleErrorKinds)
|
||||
{
|
||||
if (m_visibleErrorKinds != visibleErrorKinds) {
|
||||
m_visibleErrorKinds = visibleErrorKinds;
|
||||
emit visibleErrorKindsChanged(visibleErrorKinds);
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setEnableCacheSim(bool enable)
|
||||
{
|
||||
if (m_enableCacheSim == enable)
|
||||
return;
|
||||
|
||||
m_enableCacheSim = enable;
|
||||
emit enableCacheSimChanged(enable);
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setEnableBranchSim(bool enable)
|
||||
{
|
||||
if (m_enableBranchSim == enable)
|
||||
return;
|
||||
|
||||
m_enableBranchSim = enable;
|
||||
emit enableBranchSimChanged(enable);
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setCollectSystime(bool collect)
|
||||
{
|
||||
if (m_collectSystime == collect)
|
||||
return;
|
||||
|
||||
m_collectSystime = collect;
|
||||
emit collectSystimeChanged(collect);
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setCollectBusEvents(bool collect)
|
||||
{
|
||||
if (m_collectBusEvents == collect)
|
||||
return;
|
||||
|
||||
m_collectBusEvents = collect;
|
||||
emit collectBusEventsChanged(collect);
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setEnableEventToolTips(bool enable)
|
||||
{
|
||||
if (m_enableEventToolTips == enable)
|
||||
return;
|
||||
|
||||
m_enableEventToolTips = enable;
|
||||
emit enableEventToolTipsChanged(enable);
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setMinimumInclusiveCostRatio(
|
||||
double minimumInclusiveCostRatio)
|
||||
{
|
||||
if (m_minimumInclusiveCostRatio == minimumInclusiveCostRatio)
|
||||
return;
|
||||
|
||||
m_minimumInclusiveCostRatio = qBound(0.0, minimumInclusiveCostRatio, 100.0);
|
||||
emit minimumInclusiveCostRatioChanged(minimumInclusiveCostRatio);
|
||||
}
|
||||
|
||||
void ValgrindBaseSettings::setVisualisationMinimumInclusiveCostRatio(
|
||||
double minimumInclusiveCostRatio)
|
||||
{
|
||||
if (m_visualisationMinimumInclusiveCostRatio == minimumInclusiveCostRatio)
|
||||
return;
|
||||
|
||||
m_visualisationMinimumInclusiveCostRatio = qBound(0.0, minimumInclusiveCostRatio, 100.0);
|
||||
emit visualisationMinimumInclusiveCostRatioChanged(minimumInclusiveCostRatio);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ValgrindGlobalSettings
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
QWidget *ValgrindGlobalSettings::createConfigWidget(QWidget *parent)
|
||||
{
|
||||
return new ValgrindConfigWidget(this, parent, true);
|
||||
}
|
||||
|
||||
QVariantMap ValgrindGlobalSettings::defaults() const
|
||||
{
|
||||
QVariantMap map = ValgrindBaseSettings::defaults();
|
||||
|
||||
// Memcheck
|
||||
map.insert(suppressionFilesC, QStringList());
|
||||
map.insert(lastSuppressionDirectoryC, QString());
|
||||
map.insert(lastSuppressionHistoryC, QStringList());
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
||||
map.insert(QLatin1String(callgrindCycleDetectionC), true);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool ValgrindGlobalSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
ValgrindBaseSettings::fromMap(map);
|
||||
|
||||
// Memcheck
|
||||
m_suppressionFiles = map.value(suppressionFilesC).toStringList();
|
||||
m_lastSuppressionDirectory = map.value(lastSuppressionDirectoryC).toString();
|
||||
m_lastSuppressionHistory = map.value(lastSuppressionHistoryC).toStringList();
|
||||
|
||||
// Callgrind
|
||||
// special code as the default one does not cope with the enum properly
|
||||
if (map.contains(QLatin1String(callgrindCostFormatC)))
|
||||
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
|
||||
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap ValgrindGlobalSettings::toMap() const
|
||||
{
|
||||
QVariantMap map = ValgrindBaseSettings::toMap();
|
||||
|
||||
// Memcheck
|
||||
map.insert(suppressionFilesC, m_suppressionFiles);
|
||||
map.insert(lastSuppressionDirectoryC, m_lastSuppressionDirectory);
|
||||
map.insert(lastSuppressionHistoryC, m_lastSuppressionHistory);
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
|
||||
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
//
|
||||
// Memcheck
|
||||
//
|
||||
QStringList ValgrindGlobalSettings::suppressionFiles() const
|
||||
{
|
||||
return m_suppressionFiles;
|
||||
}
|
||||
|
||||
void ValgrindGlobalSettings::addSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
foreach (const QString &s, suppressions)
|
||||
if (!m_suppressionFiles.contains(s))
|
||||
m_suppressionFiles.append(s);
|
||||
}
|
||||
|
||||
|
||||
void ValgrindGlobalSettings::removeSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
foreach (const QString &s, suppressions)
|
||||
m_suppressionFiles.removeAll(s);
|
||||
}
|
||||
|
||||
QString ValgrindGlobalSettings::lastSuppressionDialogDirectory() const
|
||||
{
|
||||
return m_lastSuppressionDirectory;
|
||||
}
|
||||
|
||||
void ValgrindGlobalSettings::setLastSuppressionDialogDirectory(const QString &directory)
|
||||
{
|
||||
m_lastSuppressionDirectory = directory;
|
||||
}
|
||||
|
||||
QStringList ValgrindGlobalSettings::lastSuppressionDialogHistory() const
|
||||
{
|
||||
return m_lastSuppressionHistory;
|
||||
}
|
||||
|
||||
void ValgrindGlobalSettings::setLastSuppressionDialogHistory(const QStringList &history)
|
||||
{
|
||||
m_lastSuppressionHistory = history;
|
||||
}
|
||||
|
||||
//
|
||||
// Callgrind
|
||||
//
|
||||
CostDelegate::CostFormat ValgrindGlobalSettings::costFormat() const
|
||||
{
|
||||
return m_costFormat;
|
||||
}
|
||||
|
||||
void ValgrindGlobalSettings::setCostFormat(CostDelegate::CostFormat format)
|
||||
{
|
||||
m_costFormat = format;
|
||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
||||
}
|
||||
|
||||
bool ValgrindGlobalSettings::detectCycles() const
|
||||
{
|
||||
return m_detectCycles;
|
||||
}
|
||||
|
||||
void ValgrindGlobalSettings::setDetectCycles(bool detect)
|
||||
{
|
||||
m_detectCycles = detect;
|
||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
||||
}
|
||||
|
||||
ValgrindGlobalSettings *globalValgrindSettings()
|
||||
{
|
||||
ValgrindGlobalSettings *ret = AnalyzerGlobalSettings::instance()->subConfig<ValgrindGlobalSettings>();
|
||||
QTC_ASSERT(ret, return 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ValgrindProjectSettings
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
QWidget *ValgrindProjectSettings::createConfigWidget(QWidget *parent)
|
||||
{
|
||||
return new ValgrindConfigWidget(this, parent, false);
|
||||
}
|
||||
|
||||
QVariantMap ValgrindProjectSettings::defaults() const
|
||||
{
|
||||
QVariantMap map = ValgrindBaseSettings::defaults();
|
||||
|
||||
// Memcheck
|
||||
map.insert(addedSuppressionFilesC, QStringList());
|
||||
map.insert(removedSuppressionFilesC, QStringList());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool ValgrindProjectSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
ValgrindBaseSettings::fromMap(map);
|
||||
|
||||
// Memcheck
|
||||
setIfPresent(map, addedSuppressionFilesC, &m_addedSuppressionFiles);
|
||||
setIfPresent(map, removedSuppressionFilesC, &m_disabledGlobalSuppressionFiles);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap ValgrindProjectSettings::toMap() const
|
||||
{
|
||||
QVariantMap map = ValgrindBaseSettings::toMap();
|
||||
|
||||
// Memcheck
|
||||
map.insert(addedSuppressionFilesC, m_addedSuppressionFiles);
|
||||
map.insert(removedSuppressionFilesC, m_disabledGlobalSuppressionFiles);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
//
|
||||
// Memcheck
|
||||
//
|
||||
|
||||
void ValgrindProjectSettings::addSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
QStringList globalSuppressions = globalValgrindSettings()->suppressionFiles();
|
||||
foreach (const QString &s, suppressions) {
|
||||
if (m_addedSuppressionFiles.contains(s))
|
||||
continue;
|
||||
m_disabledGlobalSuppressionFiles.removeAll(s);
|
||||
if (!globalSuppressions.contains(s))
|
||||
m_addedSuppressionFiles.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindProjectSettings::removeSuppressionFiles(const QStringList &suppressions)
|
||||
{
|
||||
QStringList globalSuppressions = globalValgrindSettings()->suppressionFiles();
|
||||
foreach (const QString &s, suppressions) {
|
||||
m_addedSuppressionFiles.removeAll(s);
|
||||
if (globalSuppressions.contains(s))
|
||||
m_disabledGlobalSuppressionFiles.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList ValgrindProjectSettings::suppressionFiles() const
|
||||
{
|
||||
QStringList ret = globalValgrindSettings()->suppressionFiles();
|
||||
foreach (const QString &s, m_disabledGlobalSuppressionFiles)
|
||||
ret.removeAll(s);
|
||||
ret.append(m_addedSuppressionFiles);
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
@@ -36,30 +36,37 @@
|
||||
#define ANALYZER_INTERNAL_VALGRINDSETTINGS_H
|
||||
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
#include "callgrindcostdelegate.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
/**
|
||||
* Generic Valgrind settings shared by all tools.
|
||||
* Valgrind settings shared for global and per-project.
|
||||
*/
|
||||
class ValgrindSettings : public Analyzer::AbstractAnalyzerSubConfig
|
||||
class ValgrindBaseSettings : public Analyzer::AbstractAnalyzerSubConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ValgrindSettings() {}
|
||||
ValgrindBaseSettings() {}
|
||||
|
||||
virtual QVariantMap toMap() const;
|
||||
virtual QVariantMap defaults() const;
|
||||
|
||||
QString valgrindExecutable() const;
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QWidget *createConfigWidget(QWidget *parent);
|
||||
|
||||
/**
|
||||
* Base valgrind settings
|
||||
*/
|
||||
public:
|
||||
QString valgrindExecutable() const;
|
||||
|
||||
public slots:
|
||||
void setValgrindExecutable(const QString &);
|
||||
@@ -67,11 +74,179 @@ public slots:
|
||||
signals:
|
||||
void valgrindExecutableChanged(const QString &);
|
||||
|
||||
protected:
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
QString m_valgrindExecutable;
|
||||
|
||||
|
||||
/**
|
||||
* Base memcheck settings
|
||||
*/
|
||||
public:
|
||||
int numCallers() const { return m_numCallers; }
|
||||
bool trackOrigins() const { return m_trackOrigins; }
|
||||
bool filterExternalIssues() const { return m_filterExternalIssues; }
|
||||
QList<int> visibleErrorKinds() const { return m_visibleErrorKinds; }
|
||||
|
||||
virtual QStringList suppressionFiles() const = 0;
|
||||
virtual void addSuppressionFiles(const QStringList &) = 0;
|
||||
virtual void removeSuppressionFiles(const QStringList &) = 0;
|
||||
|
||||
public slots:
|
||||
void setNumCallers(int);
|
||||
void setTrackOrigins(bool);
|
||||
void setFilterExternalIssues(bool);
|
||||
void setVisibleErrorKinds(const QList<int> &);
|
||||
|
||||
signals:
|
||||
void numCallersChanged(int);
|
||||
void trackOriginsChanged(bool);
|
||||
void filterExternalIssuesChanged(bool);
|
||||
void visibleErrorKindsChanged(const QList<int> &);
|
||||
void suppressionFilesRemoved(const QStringList &);
|
||||
void suppressionFilesAdded(const QStringList &);
|
||||
|
||||
protected:
|
||||
int m_numCallers;
|
||||
bool m_trackOrigins;
|
||||
bool m_filterExternalIssues;
|
||||
QList<int> m_visibleErrorKinds;
|
||||
|
||||
/**
|
||||
* Base callgrind settings
|
||||
*/
|
||||
public:
|
||||
bool enableCacheSim() const { return m_enableCacheSim; }
|
||||
bool enableBranchSim() const { return m_enableBranchSim; }
|
||||
bool collectSystime() const { return m_collectSystime; }
|
||||
bool collectBusEvents() const { return m_collectBusEvents; }
|
||||
bool enableEventToolTips() const { return m_enableEventToolTips; }
|
||||
|
||||
/// \return Minimum cost ratio, range [0.0..100.0]
|
||||
double minimumInclusiveCostRatio() const { return m_minimumInclusiveCostRatio; }
|
||||
|
||||
/// \return Minimum cost ratio, range [0.0..100.0]
|
||||
double visualisationMinimumInclusiveCostRatio() const { return m_visualisationMinimumInclusiveCostRatio; }
|
||||
|
||||
public slots:
|
||||
void setEnableCacheSim(bool enable);
|
||||
void setEnableBranchSim(bool enable);
|
||||
void setCollectSystime(bool collect);
|
||||
void setCollectBusEvents(bool collect);
|
||||
void setEnableEventToolTips(bool enable);
|
||||
|
||||
/// \param minimumInclusiveCostRatio Minimum inclusive cost ratio, valid values are [0.0..100.0]
|
||||
void setMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
|
||||
|
||||
/// \param minimumInclusiveCostRatio Minimum inclusive cost ratio, valid values are [0.0..100.0]
|
||||
void setVisualisationMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
|
||||
|
||||
signals:
|
||||
void enableCacheSimChanged(bool);
|
||||
void enableBranchSimChanged(bool);
|
||||
void collectSystimeChanged(bool);
|
||||
void collectBusEventsChanged(bool);
|
||||
void enableEventToolTipsChanged(bool);
|
||||
void minimumInclusiveCostRatioChanged(double);
|
||||
void visualisationMinimumInclusiveCostRatioChanged(double);
|
||||
|
||||
private:
|
||||
bool m_enableCacheSim;
|
||||
bool m_collectSystime;
|
||||
bool m_collectBusEvents;
|
||||
bool m_enableBranchSim;
|
||||
bool m_enableEventToolTips;
|
||||
double m_minimumInclusiveCostRatio;
|
||||
double m_visualisationMinimumInclusiveCostRatio;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Global valgrind settings
|
||||
*/
|
||||
class ValgrindGlobalSettings : public ValgrindBaseSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ValgrindGlobalSettings() {}
|
||||
|
||||
QWidget *createConfigWidget(QWidget *parent);
|
||||
QVariantMap toMap() const;
|
||||
QVariantMap defaults() const;
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
/*
|
||||
* Global memcheck settings
|
||||
*/
|
||||
public:
|
||||
QStringList suppressionFiles() const;
|
||||
// in the global settings we change the internal list directly
|
||||
void addSuppressionFiles(const QStringList &);
|
||||
void removeSuppressionFiles(const QStringList &);
|
||||
|
||||
// internal settings which don't require any UI
|
||||
void setLastSuppressionDialogDirectory(const QString &directory);
|
||||
QString lastSuppressionDialogDirectory() const;
|
||||
|
||||
void setLastSuppressionDialogHistory(const QStringList &history);
|
||||
QStringList lastSuppressionDialogHistory() const;
|
||||
|
||||
private:
|
||||
QStringList m_suppressionFiles;
|
||||
QString m_lastSuppressionDirectory;
|
||||
QStringList m_lastSuppressionHistory;
|
||||
|
||||
|
||||
/**
|
||||
* Global callgrind settings
|
||||
*/
|
||||
public:
|
||||
|
||||
CostDelegate::CostFormat costFormat() const;
|
||||
bool detectCycles() const;
|
||||
|
||||
public slots:
|
||||
void setCostFormat(Valgrind::Internal::CostDelegate::CostFormat format);
|
||||
void setDetectCycles(bool detect);
|
||||
|
||||
private:
|
||||
CostDelegate::CostFormat m_costFormat;
|
||||
bool m_detectCycles;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Per-project valgrind settings.
|
||||
*/
|
||||
class ValgrindProjectSettings : public ValgrindBaseSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ValgrindProjectSettings() {}
|
||||
|
||||
QWidget *createConfigWidget(QWidget *parent);
|
||||
QVariantMap toMap() const;
|
||||
QVariantMap defaults() const;
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
/**
|
||||
* Per-project memcheck settings, saves a diff to the global suppression files list
|
||||
*/
|
||||
public:
|
||||
QStringList suppressionFiles() const;
|
||||
// in the project-specific settings we store a diff to the global list
|
||||
void addSuppressionFiles(const QStringList &suppressions);
|
||||
void removeSuppressionFiles(const QStringList &suppressions);
|
||||
|
||||
private:
|
||||
QStringList m_disabledGlobalSuppressionFiles;
|
||||
QStringList m_addedSuppressionFiles;
|
||||
|
||||
|
||||
/**
|
||||
* Per-project callgrind settings, saves a diff to the global suppression files list
|
||||
*/
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user