2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
2011-03-04 12:15:18 +01:00
|
|
|
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
2016-01-15 14:57:40 +01:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
#include "callgrindcostdelegate.h"
|
2013-08-12 17:04:10 +02:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QVariant>
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2011-04-04 14:39:28 +02:00
|
|
|
namespace Valgrind {
|
2011-03-04 12:15:18 +01:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-08-08 17:37:37 +02:00
|
|
|
const char ANALYZER_VALGRIND_SETTINGS[] = "Analyzer.Valgrind.Settings";
|
|
|
|
|
|
2011-03-04 12:15:18 +01:00
|
|
|
/**
|
2011-07-12 16:47:32 +02:00
|
|
|
* Valgrind settings shared for global and per-project.
|
2011-03-04 12:15:18 +01:00
|
|
|
*/
|
2013-08-12 17:04:10 +02:00
|
|
|
class ValgrindBaseSettings : public ProjectExplorer::ISettingsAspect
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2011-07-12 16:47:32 +02:00
|
|
|
|
2011-03-04 12:15:18 +01:00
|
|
|
public:
|
2013-09-06 16:33:48 +02:00
|
|
|
enum SelfModifyingCodeDetection {
|
|
|
|
|
DetectSmcNo,
|
|
|
|
|
DetectSmcStackOnly,
|
|
|
|
|
DetectSmcEverywhere,
|
|
|
|
|
DetectSmcEverywhereButFile
|
|
|
|
|
};
|
|
|
|
|
|
2013-09-09 11:43:39 +02:00
|
|
|
enum LeakCheckOnFinish {
|
|
|
|
|
LeakCheckOnFinishNo,
|
|
|
|
|
LeakCheckOnFinishSummaryOnly,
|
|
|
|
|
LeakCheckOnFinishYes
|
|
|
|
|
};
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
ValgrindBaseSettings() {}
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2013-08-12 17:05:52 +02:00
|
|
|
void toMap(QVariantMap &map) const;
|
|
|
|
|
void fromMap(const QVariantMap &map);
|
2011-07-12 16:47:32 +02:00
|
|
|
|
2011-07-25 20:16:29 +02:00
|
|
|
signals:
|
|
|
|
|
void changed(); // sent when multiple values have changed simulatenously (e.g. fromMap)
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
/**
|
|
|
|
|
* Base valgrind settings
|
|
|
|
|
*/
|
|
|
|
|
public:
|
|
|
|
|
QString valgrindExecutable() const;
|
2013-09-06 16:33:48 +02:00
|
|
|
SelfModifyingCodeDetection selfModifyingCodeDetection() const;
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
void setValgrindExecutable(const QString &);
|
2013-09-06 16:33:48 +02:00
|
|
|
void setSelfModifyingCodeDetection(int);
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
signals:
|
2013-09-06 16:33:48 +02:00
|
|
|
void selfModifyingCodeDetectionChanged(int);
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
private:
|
|
|
|
|
QString m_valgrindExecutable;
|
2013-09-06 16:33:48 +02:00
|
|
|
SelfModifyingCodeDetection m_selfModifyingCodeDetection;
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Base memcheck settings
|
|
|
|
|
*/
|
|
|
|
|
public:
|
|
|
|
|
int numCallers() const { return m_numCallers; }
|
2013-09-09 11:43:39 +02:00
|
|
|
LeakCheckOnFinish leakCheckOnFinish() const { return m_leakCheckOnFinish; }
|
|
|
|
|
bool showReachable() const { return m_showReachable; }
|
2011-07-12 16:47:32 +02:00
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
void setNumCallers(int);
|
2013-09-09 11:43:39 +02:00
|
|
|
void setLeakCheckOnFinish(int);
|
|
|
|
|
void setShowReachable(bool);
|
2011-07-12 16:47:32 +02:00
|
|
|
void setTrackOrigins(bool);
|
|
|
|
|
void setFilterExternalIssues(bool);
|
|
|
|
|
void setVisibleErrorKinds(const QList<int> &);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void numCallersChanged(int);
|
2013-09-09 11:43:39 +02:00
|
|
|
void leakCheckOnFinishChanged(int);
|
|
|
|
|
void showReachableChanged(bool);
|
2011-07-12 16:47:32 +02:00
|
|
|
void trackOriginsChanged(bool);
|
|
|
|
|
void filterExternalIssuesChanged(bool);
|
|
|
|
|
void visibleErrorKindsChanged(const QList<int> &);
|
|
|
|
|
void suppressionFilesRemoved(const QStringList &);
|
|
|
|
|
void suppressionFilesAdded(const QStringList &);
|
|
|
|
|
|
2011-03-04 12:15:18 +01:00
|
|
|
protected:
|
2011-07-12 16:47:32 +02:00
|
|
|
int m_numCallers;
|
2013-09-09 11:43:39 +02:00
|
|
|
LeakCheckOnFinish m_leakCheckOnFinish;
|
|
|
|
|
bool m_showReachable;
|
2011-07-12 16:47:32 +02:00
|
|
|
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; }
|
|
|
|
|
|
|
|
|
|
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);
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
private:
|
2011-07-12 16:47:32 +02:00
|
|
|
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:
|
2013-08-08 17:37:37 +02:00
|
|
|
ValgrindGlobalSettings();
|
2011-07-12 16:47:32 +02:00
|
|
|
|
2018-04-26 11:03:34 +02:00
|
|
|
QWidget *createConfigWidget(QWidget *parent) override;
|
2013-08-12 17:05:52 +02:00
|
|
|
void toMap(QVariantMap &map) const;
|
2012-02-22 12:36:39 +01:00
|
|
|
void fromMap(const QVariantMap &map);
|
2013-08-12 15:21:22 +02:00
|
|
|
ISettingsAspect *create() const { return new ValgrindGlobalSettings; }
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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;
|
|
|
|
|
|
2013-08-08 17:37:37 +02:00
|
|
|
void writeSettings() const;
|
|
|
|
|
void readSettings();
|
|
|
|
|
|
2011-07-12 16:47:32 +02:00
|
|
|
private:
|
|
|
|
|
QStringList m_suppressionFiles;
|
|
|
|
|
QString m_lastSuppressionDirectory;
|
|
|
|
|
QStringList m_lastSuppressionHistory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Global callgrind settings
|
|
|
|
|
*/
|
|
|
|
|
public:
|
|
|
|
|
CostDelegate::CostFormat costFormat() const;
|
|
|
|
|
bool detectCycles() const;
|
2012-08-22 23:35:02 +02:00
|
|
|
bool shortenTemplates() const;
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
void setCostFormat(Valgrind::Internal::CostDelegate::CostFormat format);
|
2012-08-22 23:35:02 +02:00
|
|
|
void setDetectCycles(bool on);
|
|
|
|
|
void setShortenTemplates(bool on);
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
CostDelegate::CostFormat m_costFormat;
|
|
|
|
|
bool m_detectCycles;
|
2012-08-22 23:35:02 +02:00
|
|
|
bool m_shortenTemplates;
|
2011-07-12 16:47:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Per-project valgrind settings.
|
|
|
|
|
*/
|
|
|
|
|
class ValgrindProjectSettings : public ValgrindBaseSettings
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ValgrindProjectSettings() {}
|
|
|
|
|
|
2018-04-26 11:03:34 +02:00
|
|
|
QWidget *createConfigWidget(QWidget *parent) override;
|
2013-08-12 17:05:52 +02:00
|
|
|
void toMap(QVariantMap &map) const;
|
2012-02-22 12:36:39 +01:00
|
|
|
void fromMap(const QVariantMap &map);
|
2013-08-12 15:21:22 +02:00
|
|
|
ISettingsAspect *create() const { return new ValgrindProjectSettings; }
|
2011-07-12 16:47:32 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
2011-03-04 12:15:18 +01:00
|
|
|
};
|
|
|
|
|
|
2011-05-18 19:35:42 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Valgrind
|