2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-03-04 12:15:18 +01:00
|
|
|
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, 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, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-03-04 12:15:18 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
#include "valgrindsettings.h"
|
|
|
|
|
#include "valgrindconfigwidget.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <utils/qtcassert.h>
|
2011-07-12 16:47:32 +02:00
|
|
|
#include <valgrind/xmlprotocol/error.h>
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QSettings>
|
|
|
|
|
#include <QDebug>
|
2011-07-12 16:47:32 +02:00
|
|
|
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
using namespace Analyzer;
|
|
|
|
|
|
2012-08-22 23:35:02 +02:00
|
|
|
const char numCallersC[] = "Analyzer.Valgrind.NumCallers";
|
|
|
|
|
const char trackOriginsC[] = "Analyzer.Valgrind.TrackOrigins";
|
|
|
|
|
const char suppressionFilesC[] = "Analyzer.Valgrind.SupressionFiles";
|
|
|
|
|
const char removedSuppressionFilesC[] = "Analyzer.Valgrind.RemovedSuppressionFiles";
|
|
|
|
|
const char addedSuppressionFilesC[] = "Analyzer.Valgrind.AddedSuppressionFiles";
|
|
|
|
|
const char filterExternalIssuesC[] = "Analyzer.Valgrind.FilterExternalIssues";
|
|
|
|
|
const char visibleErrorKindsC[] = "Analyzer.Valgrind.VisibleErrorKinds";
|
|
|
|
|
|
|
|
|
|
const char lastSuppressionDirectoryC[] = "Analyzer.Valgrind.LastSuppressionDirectory";
|
|
|
|
|
const char lastSuppressionHistoryC[] = "Analyzer.Valgrind.LastSuppressionHistory";
|
|
|
|
|
|
|
|
|
|
const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.EnableCacheSim";
|
|
|
|
|
const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
|
|
|
|
|
const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
|
|
|
|
|
const char callgrindCollectBusEventsC[] = "Analyzer.Valgrind.Callgrind.CollectBusEvents";
|
|
|
|
|
const char callgrindEnableEventToolTipsC[] = "Analyzer.Valgrind.Callgrind.EnableEventToolTips";
|
|
|
|
|
const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
|
|
|
|
|
const char callgrindVisualisationMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio";
|
|
|
|
|
|
|
|
|
|
const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
|
|
|
|
|
const char callgrindShortenTemplates[] = "Analyzer.Valgrind.Callgrind.ShortenTemplates";
|
|
|
|
|
const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
|
|
|
|
|
|
|
|
|
|
const char valgrindExeC[] = "Analyzer.Valgrind.ValgrindExecutable";
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
namespace Valgrind {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ValgrindBaseSettings
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
QVariantMap ValgrindBaseSettings::defaults() const
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
|
|
|
|
QVariantMap map;
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
2011-03-04 12:15:18 +01:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-22 12:36:39 +01:00
|
|
|
void ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
2011-07-12 16:47:32 +02:00
|
|
|
// 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);
|
|
|
|
|
|
2011-07-25 20:16:29 +02:00
|
|
|
emit changed();
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
QVariantMap ValgrindBaseSettings::toMap() const
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
|
|
|
|
QVariantMap map;
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
// 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);
|
2011-03-04 12:15:18 +01:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
void ValgrindBaseSettings::setValgrindExecutable(const QString &valgrindExecutable)
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
|
|
|
|
if (m_valgrindExecutable != valgrindExecutable) {
|
|
|
|
|
m_valgrindExecutable = valgrindExecutable;
|
|
|
|
|
emit valgrindExecutableChanged(valgrindExecutable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
QString ValgrindBaseSettings::valgrindExecutable() const
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
|
|
|
|
return m_valgrindExecutable;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
QString ValgrindBaseSettings::id() const
|
|
|
|
|
{
|
2012-11-26 15:02:17 +02:00
|
|
|
return QLatin1String("Analyzer.Valgrind.Settings");
|
2011-07-12 16:47:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString ValgrindBaseSettings::displayName() const
|
|
|
|
|
{
|
|
|
|
|
return tr("Valgrind");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ValgrindBaseSettings::setNumCallers(int numCallers)
|
|
|
|
|
{
|
|
|
|
|
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
|
2012-11-26 15:02:17 +02:00
|
|
|
map.insert(QLatin1String(suppressionFilesC), QStringList());
|
|
|
|
|
map.insert(QLatin1String(lastSuppressionDirectoryC), QString());
|
|
|
|
|
map.insert(QLatin1String(lastSuppressionHistoryC), QStringList());
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
// Callgrind
|
|
|
|
|
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
|
|
|
|
map.insert(QLatin1String(callgrindCycleDetectionC), true);
|
|
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-22 12:36:39 +01:00
|
|
|
void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
|
2011-07-12 16:47:32 +02:00
|
|
|
{
|
|
|
|
|
ValgrindBaseSettings::fromMap(map);
|
|
|
|
|
|
|
|
|
|
// Memcheck
|
2012-11-26 15:02:17 +02:00
|
|
|
m_suppressionFiles = map.value(QLatin1String(suppressionFilesC)).toStringList();
|
|
|
|
|
m_lastSuppressionDirectory = map.value(QLatin1String(lastSuppressionDirectoryC)).toString();
|
|
|
|
|
m_lastSuppressionHistory = map.value(QLatin1String(lastSuppressionHistoryC)).toStringList();
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
// 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);
|
2012-08-22 23:35:02 +02:00
|
|
|
setIfPresent(map, QLatin1String(callgrindShortenTemplates), &m_shortenTemplates);
|
2011-07-12 16:47:32 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-20 14:42:57 +02:00
|
|
|
AbstractAnalyzerSubConfig *ValgrindGlobalSettings::clone()
|
|
|
|
|
{
|
|
|
|
|
ValgrindGlobalSettings *other = new ValgrindGlobalSettings;
|
|
|
|
|
other->fromMap(toMap());
|
|
|
|
|
return other;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
QVariantMap ValgrindGlobalSettings::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map = ValgrindBaseSettings::toMap();
|
|
|
|
|
|
|
|
|
|
// Memcheck
|
2012-11-26 15:02:17 +02:00
|
|
|
map.insert(QLatin1String(suppressionFilesC), m_suppressionFiles);
|
|
|
|
|
map.insert(QLatin1String(lastSuppressionDirectoryC), m_lastSuppressionDirectory);
|
|
|
|
|
map.insert(QLatin1String(lastSuppressionHistoryC), m_lastSuppressionHistory);
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
// Callgrind
|
|
|
|
|
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
|
|
|
|
|
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
|
2012-08-22 23:35:02 +02:00
|
|
|
map.insert(QLatin1String(callgrindShortenTemplates), m_shortenTemplates);
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 23:35:02 +02:00
|
|
|
void ValgrindGlobalSettings::setDetectCycles(bool on)
|
2011-07-12 16:47:32 +02:00
|
|
|
{
|
2012-08-22 23:35:02 +02:00
|
|
|
m_detectCycles = on;
|
|
|
|
|
AnalyzerGlobalSettings::instance()->writeSettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ValgrindGlobalSettings::shortenTemplates() const
|
|
|
|
|
{
|
|
|
|
|
return m_shortenTemplates;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ValgrindGlobalSettings::setShortenTemplates(bool on)
|
|
|
|
|
{
|
|
|
|
|
m_shortenTemplates = on;
|
2011-07-12 16:47:32 +02:00
|
|
|
AnalyzerGlobalSettings::instance()->writeSettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ValgrindGlobalSettings *globalValgrindSettings()
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
2011-07-12 16:47:32 +02:00
|
|
|
ValgrindGlobalSettings *ret = AnalyzerGlobalSettings::instance()->subConfig<ValgrindGlobalSettings>();
|
|
|
|
|
QTC_ASSERT(ret, return 0);
|
|
|
|
|
return ret;
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ValgrindProjectSettings
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
QWidget *ValgrindProjectSettings::createConfigWidget(QWidget *parent)
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
2011-07-12 16:47:32 +02:00
|
|
|
return new ValgrindConfigWidget(this, parent, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap ValgrindProjectSettings::defaults() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map = ValgrindBaseSettings::defaults();
|
|
|
|
|
|
|
|
|
|
// Memcheck
|
2012-11-26 15:02:17 +02:00
|
|
|
map.insert(QLatin1String(addedSuppressionFilesC), QStringList());
|
|
|
|
|
map.insert(QLatin1String(removedSuppressionFilesC), QStringList());
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
return map;
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
2012-02-22 12:36:39 +01:00
|
|
|
void ValgrindProjectSettings::fromMap(const QVariantMap &map)
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
2011-07-12 16:47:32 +02:00
|
|
|
ValgrindBaseSettings::fromMap(map);
|
|
|
|
|
|
|
|
|
|
// Memcheck
|
2012-11-26 15:02:17 +02:00
|
|
|
setIfPresent(map, QLatin1String(addedSuppressionFilesC), &m_addedSuppressionFiles);
|
|
|
|
|
setIfPresent(map, QLatin1String(removedSuppressionFilesC), &m_disabledGlobalSuppressionFiles);
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
2011-07-12 16:47:32 +02:00
|
|
|
|
2012-09-20 14:42:57 +02:00
|
|
|
AbstractAnalyzerSubConfig *ValgrindProjectSettings::clone()
|
|
|
|
|
{
|
|
|
|
|
ValgrindProjectSettings *other = new ValgrindProjectSettings;
|
|
|
|
|
other->fromMap(toMap());
|
|
|
|
|
return other;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
QVariantMap ValgrindProjectSettings::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map = ValgrindBaseSettings::toMap();
|
|
|
|
|
|
|
|
|
|
// Memcheck
|
2012-11-26 15:02:17 +02:00
|
|
|
map.insert(QLatin1String(addedSuppressionFilesC), m_addedSuppressionFiles);
|
|
|
|
|
map.insert(QLatin1String(removedSuppressionFilesC), m_disabledGlobalSuppressionFiles);
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
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
|