summaryrefslogtreecommitdiff
path: root/src/plugins/memcheck
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2011-05-23 13:50:28 +0200
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-05-23 13:55:11 +0200
commit8bb99e4c75694ce29f912c6c2d62e8fdc577c920 (patch)
tree921263edb7f5528743ec480675a35221f229d8f8 /src/plugins/memcheck
parent84f60e5fda5f4b30cc21a05276b3adc4fb5b03a1 (diff)
downloadqt-creator-8bb99e4c75694ce29f912c6c2d62e8fdc577c920.tar.gz
analyzer: merge valgrind based tool plugins
It is hard to imagine there is a real use case that someone wants one but absolutely not the other. Change-Id: I58bb57912f2edeacf2d5a24e3b2eb5a81262eabd Reviewed-on: http://codereview.qt.nokia.com/66 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins/memcheck')
-rw-r--r--src/plugins/memcheck/Memcheck.pluginspec.in21
-rw-r--r--src/plugins/memcheck/memcheck.pri4
-rw-r--r--src/plugins/memcheck/memcheck.pro32
-rw-r--r--src/plugins/memcheck/memcheck_dependencies.pri3
-rw-r--r--src/plugins/memcheck/memcheck_global.h46
-rw-r--r--src/plugins/memcheck/memcheckconfigwidget.cpp182
-rw-r--r--src/plugins/memcheck/memcheckconfigwidget.h80
-rw-r--r--src/plugins/memcheck/memcheckconfigwidget.ui130
-rw-r--r--src/plugins/memcheck/memcheckengine.cpp148
-rw-r--r--src/plugins/memcheck/memcheckengine.h80
-rw-r--r--src/plugins/memcheck/memcheckerrorview.cpp512
-rw-r--r--src/plugins/memcheck/memcheckerrorview.h125
-rw-r--r--src/plugins/memcheck/memcheckplugin.cpp74
-rw-r--r--src/plugins/memcheck/memcheckplugin.h57
-rw-r--r--src/plugins/memcheck/memchecksettings.cpp280
-rw-r--r--src/plugins/memcheck/memchecksettings.h152
-rw-r--r--src/plugins/memcheck/memchecktool.cpp550
-rw-r--r--src/plugins/memcheck/memchecktool.h149
-rw-r--r--src/plugins/memcheck/suppressiondialog.cpp259
-rw-r--r--src/plugins/memcheck/suppressiondialog.h81
-rw-r--r--src/plugins/memcheck/suppressiondialog.ui107
21 files changed, 0 insertions, 3072 deletions
diff --git a/src/plugins/memcheck/Memcheck.pluginspec.in b/src/plugins/memcheck/Memcheck.pluginspec.in
deleted file mode 100644
index ff4484e23b..0000000000
--- a/src/plugins/memcheck/Memcheck.pluginspec.in
+++ /dev/null
@@ -1,21 +0,0 @@
-<plugin name=\"Memcheck\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\">
- <vendor>Nokia Corporation</vendor>
- <copyright>(C) 2011 Nokia Corporation</copyright>
- <license>
-Commercial Usage
-
-Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
-
-GNU Lesser General Public License Usage
-
-Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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.
- </license>
- <category>Code Analyzer</category>
- <description>Valgrind Memcheck Tool Plugin</description>
- <url>http://qt.nokia.com</url>
- <dependencyList>
- <dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
- <dependency name=\"AnalyzerBase\" version=\"$$QTCREATOR_VERSION\"/>
- <dependency name=\"ValgrindToolBase\" version=\"$$QTCREATOR_VERSION\"/>
- </dependencyList>
-</plugin>
diff --git a/src/plugins/memcheck/memcheck.pri b/src/plugins/memcheck/memcheck.pri
deleted file mode 100644
index 9224189ba2..0000000000
--- a/src/plugins/memcheck/memcheck.pri
+++ /dev/null
@@ -1,4 +0,0 @@
-include(memcheck_dependencies.pri)
-
-INCLUDEPATH += $$PWD
-LIBS *= -l$$qtLibraryName(Memcheck)
diff --git a/src/plugins/memcheck/memcheck.pro b/src/plugins/memcheck/memcheck.pro
deleted file mode 100644
index e6843ed307..0000000000
--- a/src/plugins/memcheck/memcheck.pro
+++ /dev/null
@@ -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 \
diff --git a/src/plugins/memcheck/memcheck_dependencies.pri b/src/plugins/memcheck/memcheck_dependencies.pri
deleted file mode 100644
index 5f4bbc642e..0000000000
--- a/src/plugins/memcheck/memcheck_dependencies.pri
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../../plugins/coreplugin/coreplugin.pri)
-include(../../plugins/analyzerbase/analyzerbase.pri)
-include(../../plugins/valgrindtoolbase/valgrindtoolbase.pri)
diff --git a/src/plugins/memcheck/memcheck_global.h b/src/plugins/memcheck/memcheck_global.h
deleted file mode 100644
index ecc73dbef7..0000000000
--- a/src/plugins/memcheck/memcheck_global.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@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 MEMCHECK_GLOBAL_H
-#define MEMCHECK_GLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-#if defined(MEMCHECK_LIBRARY)
-# define MEMCHECKSHARED_EXPORT Q_DECL_EXPORT
-#else
-# define MEMCHECKSHARED_EXPORT Q_DECL_IMPORT
-#endif
-
-#endif // MEMCHECK_GLOBAL_H
diff --git a/src/plugins/memcheck/memcheckconfigwidget.cpp b/src/plugins/memcheck/memcheckconfigwidget.cpp
deleted file mode 100644
index ff2b282061..0000000000
--- a/src/plugins/memcheck/memcheckconfigwidget.cpp
+++ /dev/null
@@ -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 Memcheck {
-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 Memcheck
diff --git a/src/plugins/memcheck/memcheckconfigwidget.h b/src/plugins/memcheck/memcheckconfigwidget.h
deleted file mode 100644
index 26e54a8f83..0000000000
--- a/src/plugins/memcheck/memcheckconfigwidget.h
+++ /dev/null
@@ -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 Memcheck {
-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 Memcheck
-
-#endif // ANALYZER_INTERNAL_MEMCHECKCONFIGWIDGET_H
diff --git a/src/plugins/memcheck/memcheckconfigwidget.ui b/src/plugins/memcheck/memcheckconfigwidget.ui
deleted file mode 100644
index 8b0ebf6de5..0000000000
--- a/src/plugins/memcheck/memcheckconfigwidget.ui
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Memcheck::Internal::MemcheckConfigWidget</class>
- <widget class="QWidget" name="Memcheck::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>
diff --git a/src/plugins/memcheck/memcheckengine.cpp b/src/plugins/memcheck/memcheckengine.cpp
deleted file mode 100644
index 4e46c2b016..0000000000
--- a/src/plugins/memcheck/memcheckengine.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@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 "memcheckengine.h"
-
-#include "memchecksettings.h"
-
-#include <analyzerbase/analyzersettings.h>
-
-#include <valgrind/xmlprotocol/error.h>
-#include <valgrind/xmlprotocol/status.h>
-
-#include <utils/qtcassert.h>
-
-using namespace Analyzer;
-using namespace Valgrind::XmlProtocol;
-
-namespace Memcheck {
-namespace Internal {
-
-MemcheckEngine::MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
- : ValgrindEngine(sp, runConfiguration)
-{
- connect(&m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
- SIGNAL(parserError(Valgrind::XmlProtocol::Error)));
- connect(&m_parser, SIGNAL(suppressionCount(QString,qint64)),
- SIGNAL(suppressionCount(QString,qint64)));
- connect(&m_parser, SIGNAL(internalError(QString)),
- SIGNAL(internalParserError(QString)));
- connect(&m_parser, SIGNAL(status(Valgrind::XmlProtocol::Status)),
- SLOT(status(Valgrind::XmlProtocol::Status)));
-
- m_progress->setProgressRange(0, Valgrind::XmlProtocol::Status::Finished + 1);
-}
-
-QString MemcheckEngine::progressTitle() const
-{
- return tr("Analyzing Memory");
-}
-
-Valgrind::ValgrindRunner *MemcheckEngine::runner()
-{
- return &m_runner;
-}
-
-void MemcheckEngine::start()
-{
- m_runner.setParser(&m_parser);
-
- emit standardOutputReceived(tr("Analyzing memory of %1").arg(executable()));
- ValgrindEngine::start();
-}
-
-void MemcheckEngine::stop()
-{
- disconnect(&m_parser, SIGNAL(internalError(QString)),
- this, SIGNAL(internalParserError(QString)));
- ValgrindEngine::stop();
-}
-
-QStringList MemcheckEngine::toolArguments() const
-{
- QStringList arguments;
- arguments << QLatin1String("--gen-suppressions=all");
-
- AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>();
- QTC_ASSERT(memcheckSettings, return arguments);
-
- if (memcheckSettings->trackOrigins())
- arguments << QLatin1String("--track-origins=yes");
-
- foreach (const QString &file, memcheckSettings->suppressionFiles())
- arguments << QString("--suppressions=%1").arg(file);
-
- arguments << QString("--num-callers=%1").arg(memcheckSettings->numCallers());
- return arguments;
-}
-
-QStringList MemcheckEngine::suppressionFiles() const
-{
- return m_settings->subConfig<AbstractMemcheckSettings>()->suppressionFiles();
-}
-
-void MemcheckEngine::status(const Status &status)
-{
- m_progress->setProgressValue(status.state() + 1);
-}
-
-void MemcheckEngine::receiveLogMessage(const QByteArray &b)
-{
- QString error = QString::fromLocal8Bit(b);
- // workaround https://bugs.kde.org/show_bug.cgi?id=255888
- error.remove(QRegExp("==*== </valgrindoutput>", Qt::CaseSensitive, QRegExp::Wildcard));
-
- error = error.trimmed();
-
- if (error.isEmpty())
- return;
-
- stop();
-
- QString file;
- int line = -1;
-
- const QRegExp suppressionError(QLatin1String("in suppressions file \"([^\"]+)\" near line (\\d+)"),
- Qt::CaseSensitive, QRegExp::RegExp2);
- if (suppressionError.indexIn(error) != -1) {
- file = suppressionError.cap(1);
- line = suppressionError.cap(2).toInt();
- }
-
- emit taskToBeAdded(ProjectExplorer::Task::Error, error, file, line);
-}
-
-} // namespace Internal
-} // namespace Memcheck
diff --git a/src/plugins/memcheck/memcheckengine.h b/src/plugins/memcheck/memcheckengine.h
deleted file mode 100644
index 6851d0a490..0000000000
--- a/src/plugins/memcheck/memcheckengine.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@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 MEMCHECKENGINE_H
-#define MEMCHECKENGINE_H
-
-#include <valgrind/memcheck/memcheckrunner.h>
-#include <valgrind/xmlprotocol/threadedparser.h>
-
-#include <valgrindtoolbase/valgrindengine.h>
-
-namespace Memcheck {
-namespace Internal {
-
-class MemcheckEngine : public Valgrind::Internal::ValgrindEngine
-{
- Q_OBJECT
-public:
- explicit MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration);
-
- void start();
- void stop();
-
- QStringList suppressionFiles() const;
-
-signals:
- void internalParserError(const QString &errorString);
- void parserError(const Valgrind::XmlProtocol::Error &error);
- void suppressionCount(const QString &name, qint64 count);
-
-protected:
- virtual QString progressTitle() const;
- virtual QStringList toolArguments() const;
- virtual Valgrind::ValgrindRunner *runner();
-
-private slots:
- void receiveLogMessage(const QByteArray &);
- void status(const Valgrind::XmlProtocol::Status &status);
-
-private:
- Valgrind::XmlProtocol::ThreadedParser m_parser;
- Valgrind::Memcheck::MemcheckRunner m_runner;
-};
-
-} // namespace Internal
-} // namespace Memcheck
-
-#endif // MEMCHECKENGINE_H
diff --git a/src/plugins/memcheck/memcheckerrorview.cpp b/src/plugins/memcheck/memcheckerrorview.cpp
deleted file mode 100644
index ec3ab45215..0000000000
--- a/src/plugins/memcheck/memcheckerrorview.cpp
+++ /dev/null
@@ -1,512 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@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 "memcheckerrorview.h"
-
-#include "suppressiondialog.h"
-
-#include <valgrind/xmlprotocol/error.h>
-#include <valgrind/xmlprotocol/errorlistmodel.h>
-#include <valgrind/xmlprotocol/frame.h>
-#include <valgrind/xmlprotocol/stack.h>
-#include <valgrind/xmlprotocol/modelhelpers.h>
-#include <valgrind/xmlprotocol/suppression.h>
-
-#include <valgrindtoolbase/valgrindsettings.h>
-
-#include <texteditor/basetexteditor.h>
-
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/project.h>
-#include <coreplugin/coreconstants.h>
-
-#include <utils/qtcassert.h>
-
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include <QtGui/QLabel>
-#include <QtGui/QListView>
-#include <QtGui/QPainter>
-#include <QtGui/QScrollBar>
-#include <QtGui/QSortFilterProxyModel>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QAction>
-#include <QtGui/QClipboard>
-#include <QtGui/QApplication>
-#include <QtGui/QMenu>
-
-using namespace Valgrind::XmlProtocol;
-
-namespace Memcheck {
-namespace Internal {
-
-MemcheckErrorDelegate::MemcheckErrorDelegate(QListView *parent)
- : QStyledItemDelegate(parent),
- m_detailsWidget(0)
-{
- connect(parent->verticalScrollBar(), SIGNAL(valueChanged(int)),
- SLOT(verticalScrolled()));
-}
-
-QSize MemcheckErrorDelegate::sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const
-{
- const QListView *view = qobject_cast<const QListView *>(parent());
- const int viewportWidth = view->viewport()->width();
- const bool isSelected = view->selectionModel()->currentIndex() == index;
-
- int dy = 2 * s_itemMargin;
-
- if (!isSelected) {
- QFontMetrics fm(opt.font);
- return QSize(viewportWidth, fm.height() + dy);
- }
-
- if (m_detailsWidget && m_detailsIndex != index) {
- m_detailsWidget->deleteLater();
- m_detailsWidget = 0;
- }
-
- if (!m_detailsWidget) {
- m_detailsWidget = createDetailsWidget(index, view->viewport());
- QTC_ASSERT(m_detailsWidget->parent() == view->viewport(),
- m_detailsWidget->setParent(view->viewport()));
- m_detailsIndex = index;
- } else {
- QTC_ASSERT(m_detailsIndex == index, qt_noop());
- }
- const int widthExcludingMargins = viewportWidth - 2 * s_itemMargin;
- m_detailsWidget->setFixedWidth(widthExcludingMargins);
-
- m_detailsWidgetHeight = m_detailsWidget->heightForWidth(widthExcludingMargins);
- // HACK: it's a bug in QLabel(?) that we have to force the widget to have the size it said
- // it would have.
- m_detailsWidget->setFixedHeight(m_detailsWidgetHeight);
- return QSize(viewportWidth, dy + m_detailsWidget->heightForWidth(widthExcludingMargins));
-}
-
-static QString makeFrameName(const Frame &frame, const QString &relativeTo,
- bool link = true, const QString &linkAttr = QString())
-{
- const QString d = frame.directory();
- const QString f = frame.file();
- const QString fn = frame.functionName();
- const QString fullPath = d + QDir::separator() + f;
-
- QString path;
- if (!d.isEmpty() && !f.isEmpty())
- path = fullPath;
- else
- path = frame.object();
-
- if (QFile::exists(path))
- path = QFileInfo(path).canonicalFilePath();
-
- if (path.startsWith(relativeTo))
- path.remove(0, relativeTo.length());
-
- if (frame.line() != -1)
- path += QLatin1Char(':') + QString::number(frame.line());
-
- path = Qt::escape(path);
-
- if (link && !f.isEmpty() && QFile::exists(fullPath)) {
- // make a hyperlink label
- path = QString("<a href=\"file://%1:%2\" %4>%3</a>")
- .arg(fullPath, QString::number(frame.line()), path, linkAttr);
- }
-
- if (!fn.isEmpty())
- return QCoreApplication::translate("Memcheck::Internal", "%1 in %2").arg(Qt::escape(fn), path);
- if (!path.isEmpty())
- return path;
- return QString("0x%1").arg(frame.instructionPointer(), 0, 16);
-}
-
-QString relativeToPath()
-{
- // project for which we insert the snippet
- const ProjectExplorer::Project *project =
- ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
-
- QString relativeTo( project ? project->projectDirectory() : QDir::homePath() );
- if (!relativeTo.endsWith(QDir::separator()))
- relativeTo.append(QDir::separator());
-
- return relativeTo;
-}
-
-QString errorLocation(const QModelIndex &index, const Error &error,
- bool link = false, const QString &linkAttr = QString())
-{
- const ErrorListModel *model = 0;
- const QAbstractProxyModel *proxy = qobject_cast<const QAbstractProxyModel *>(index.model());
- while (!model && proxy) {
- model = qobject_cast<const ErrorListModel *>(proxy->sourceModel());
- proxy = qobject_cast<const QAbstractProxyModel *>(proxy->sourceModel());
- }
- QTC_ASSERT(model, return QString());
-
- return QCoreApplication::translate("Memcheck::Internal", "in %1").
- arg(makeFrameName(model->findRelevantFrame(error), relativeToPath(),
- link, linkAttr));
-}
-
-QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const
-{
- QWidget *widget = new QWidget(parent);
- QVBoxLayout *layout = new QVBoxLayout;
- // code + white-space:pre so the padding (see below) works properly
- // don't include frameName here as it should wrap if required and pre-line is not supported
- // by Qt yet it seems
- const QString displayTextTemplate = QString("<code style='white-space:pre'>%1:</code> %2");
-
- QString relativeTo = relativeToPath();
-
- const Error error = errorIndex.data(ErrorListModel::ErrorRole).value<Error>();
-
- QLabel *errorLabel = new QLabel();
- errorLabel->setWordWrap(true);
- errorLabel->setContentsMargins(0, 0, 0, 0);
- errorLabel->setMargin(0);
- errorLabel->setIndent(0);
- QPalette p = errorLabel->palette();
- QColor lc = p.color(QPalette::Text);
- QString linkStyle = QString("style=\"color:rgba(%1, %2, %3, %4);\"")
- .arg(lc.red()).arg(lc.green()).arg(lc.blue()).arg(int(0.7 * 255));
- p.setBrush(QPalette::Text, p.highlightedText());
- errorLabel->setPalette(p);
- errorLabel->setText(QString("%1&nbsp;&nbsp;<span %4>%2</span>")
- .arg(error.what(), errorLocation(errorIndex, error, true, linkStyle),
- linkStyle));
- connect(errorLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
- layout->addWidget(errorLabel);
-
- const QVector<Stack> stacks = error.stacks();
- for (int i = 0; i < stacks.count(); ++i) {
- const Stack &stack = stacks.at(i);
- // auxwhat for additional stacks
- if (i > 0) {
- QLabel *stackLabel = new QLabel(stack.auxWhat());
- stackLabel->setWordWrap(true);
- stackLabel->setContentsMargins(0, 0, 0, 0);
- stackLabel->setMargin(0);
- stackLabel->setIndent(0);
- QPalette p = stackLabel->palette();
- p.setBrush(QPalette::Text, p.highlightedText());
- stackLabel->setPalette(p);
- layout->addWidget(stackLabel);
- }
- int frameNr = 1;
- foreach (const Frame &frame, stack.frames()) {
- QString frameName = makeFrameName(frame, relativeTo);
- QTC_ASSERT(!frameName.isEmpty(), qt_noop());
-
- QLabel *frameLabel = new QLabel(widget);
- frameLabel->setAutoFillBackground(true);
- if (frameNr % 2 == 0) {
- // alternating rows
- QPalette p = frameLabel->palette();
- p.setBrush(QPalette::Base, p.alternateBase());
- frameLabel->setPalette(p);
- }
- frameLabel->setFont(QFont("monospace"));
- connect(frameLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
- // pad frameNr to 2 chars since only 50 frames max are supported by valgrind
- const QString displayText = displayTextTemplate
- .arg(frameNr++, 2).arg(frameName);
- frameLabel->setText(displayText);
-
- frameLabel->setToolTip(Valgrind::XmlProtocol::toolTipForFrame(frame));
- frameLabel->setWordWrap(true);
- frameLabel->setContentsMargins(0, 0, 0, 0);
- frameLabel->setMargin(0);
- frameLabel->setIndent(10);
- layout->addWidget(frameLabel);
- }
- }
-
- layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(0);
- widget->setLayout(layout);
- return widget;
-}
-
-void MemcheckErrorDelegate::paint(QPainter *painter, const QStyleOptionViewItem &basicOption,
- const QModelIndex &index) const
-{
- QStyleOptionViewItemV4 opt(basicOption);
- initStyleOption(&opt, index);
-
- const QListView *const view = qobject_cast<const QListView *>(parent());
- const bool isSelected = view->selectionModel()->currentIndex() == index;
-
- QFontMetrics fm(opt.font);
- QPoint pos = opt.rect.topLeft();
-
- painter->save();
-
- const QColor bgColor = isSelected ? opt.palette.highlight().color() : opt.palette.background().color();
- painter->setBrush(bgColor);
-
- // clear background
- painter->setPen(Qt::NoPen);
- painter->drawRect(opt.rect);
-
- pos.rx() += s_itemMargin;
- pos.ry() += s_itemMargin;
-
- const Error error = index.data(ErrorListModel::ErrorRole).value<Error>();
-
- if (isSelected) {
- // only show detailed widget and let it handle everything
- QTC_ASSERT(m_detailsIndex == index, qt_noop());
- QTC_ASSERT(m_detailsWidget, return); // should have been set in sizeHint()
- m_detailsWidget->move(pos);
- // when scrolling quickly, the widget can get stuck in a visible part of the scroll area
- // even though it should not be visible. therefore we hide it every time the scroll value
- // changes and un-hide it when the item with details widget is paint()ed, i.e. visible.
- m_detailsWidget->show();
-
- const int viewportWidth = view->viewport()->width();
- const int widthExcludingMargins = viewportWidth - 2 * s_itemMargin;
- QTC_ASSERT(m_detailsWidget->width() == widthExcludingMargins, qt_noop());
- QTC_ASSERT(m_detailsWidgetHeight == m_detailsWidget->height(), qt_noop());
- } else {
- // the reference coordinate for text drawing is the text baseline; move it inside the view rect.
- pos.ry() += fm.ascent();
-
- const QColor textColor = opt.palette.text().color();
- painter->setPen(textColor);
- // draw only text + location
- const QString what = error.what();
- painter->drawText(pos, what);
-
- const QString name = errorLocation(index, error);
- const int whatWidth = QFontMetrics(opt.font).width(what);
- const int space = 10;
- const int widthLeft = opt.rect.width() - (pos.x() + whatWidth + space + s_itemMargin);
- if (widthLeft > 0) {
- QFont monospace = opt.font;
- monospace.setFamily("monospace");
- QFontMetrics metrics(monospace);
- QColor nameColor = textColor;
- nameColor.setAlphaF(0.7);
-
- painter->setFont(monospace);
- painter->setPen(nameColor);
-
- QPoint namePos = pos;
- namePos.rx() += whatWidth + space;
- painter->drawText(namePos, metrics.elidedText(name, Qt::ElideLeft, widthLeft));
- }
- }
-
- // Separator lines (like build issues pane)
- painter->setPen(QColor::fromRgb(150,150,150));
- painter->drawLine(0, opt.rect.bottom(), opt.rect.right(), opt.rect.bottom());
-
- painter->restore();
-}
-
-void MemcheckErrorDelegate::currentChanged(const QModelIndex &now, const QModelIndex &previous)
-{
- if (m_detailsWidget) {
- m_detailsWidget->deleteLater();
- m_detailsWidget = 0;
- }
-
- m_detailsIndex = QModelIndex();
- if (now.isValid())
- emit sizeHintChanged(now);
- if (previous.isValid())
- emit sizeHintChanged(previous);
-}
-
-void MemcheckErrorDelegate::layoutChanged()
-{
- if (m_detailsWidget) {
- m_detailsWidget->deleteLater();
- m_detailsWidget = 0;
- m_detailsIndex = QModelIndex();
- }
-}
-
-void MemcheckErrorDelegate::viewResized()
-{
- const QListView *view = qobject_cast<const QListView *>(parent());
- if (m_detailsWidget)
- emit sizeHintChanged(view->selectionModel()->currentIndex());
-}
-
-void MemcheckErrorDelegate::verticalScrolled()
-{
- if (m_detailsWidget)
- m_detailsWidget->hide();
-}
-
-void MemcheckErrorDelegate::copy()
-{
- QTC_ASSERT(m_detailsIndex.isValid(), return);
-
- QString content;
- QTextStream stream(&content);
- const Error error = m_detailsIndex.data(ErrorListModel::ErrorRole).value<Error>();
-
- stream << error.what() << "\n";
- stream << " " << errorLocation(m_detailsIndex, error) << "\n";
-
- const QString relativeTo = relativeToPath();
-
- foreach (const Stack &stack, error.stacks()) {
- if (!stack.auxWhat().isEmpty()) {
- stream << stack.auxWhat();
- }
- int i = 1;
- foreach (const Frame &frame, stack.frames()) {
- stream << " " << i++ << ": " << makeFrameName(frame, relativeTo) << "\n";
- }
- }
-
- stream.flush();
- QApplication::clipboard()->setText(content);
-}
-
-void MemcheckErrorDelegate::openLinkInEditor(const QString &link)
-{
- const int pathStart = strlen("file://");
- const int pathEnd = link.lastIndexOf(':');
- const QString path = link.mid(pathStart, pathEnd - pathStart);
- const int line = link.mid(pathEnd + 1).toInt(0);
- TextEditor::BaseTextEditorWidget::openEditorAt(path, qMax(line, 0));
-}
-
-MemcheckErrorView::MemcheckErrorView(QWidget *parent)
- : QListView(parent),
- m_settings(0)
-{
- setItemDelegate(new MemcheckErrorDelegate(this));
- connect(this, SIGNAL(resized()), itemDelegate(), SLOT(viewResized()));
-
- m_copyAction = new QAction(this);
- m_copyAction->setText(tr("Copy Selection"));
- m_copyAction->setIcon(QIcon(Core::Constants::ICON_COPY));
- m_copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
- m_copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
- connect(m_copyAction, SIGNAL(triggered()), itemDelegate(), SLOT(copy()));
- addAction(m_copyAction);
-
- m_suppressAction = new QAction(this);
- m_suppressAction->setText(tr("Suppress Error"));
- m_suppressAction->setIcon(QIcon(QLatin1String(":/qmldesigner/images/eye_crossed.png")));
- m_suppressAction->setShortcut(QKeySequence(Qt::Key_Delete));
- m_suppressAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
- connect(m_suppressAction, SIGNAL(triggered()), this, SLOT(suppressError()));
- addAction(m_suppressAction);
-}
-
-MemcheckErrorView::~MemcheckErrorView()
-{
- itemDelegate()->deleteLater();
-}
-
-void MemcheckErrorView::setModel(QAbstractItemModel *model)
-{
- QListView::setModel(model);
- connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
- itemDelegate(), SLOT(currentChanged(QModelIndex,QModelIndex)));
-
- connect(model, SIGNAL(layoutChanged()),
- itemDelegate(), SLOT(layoutChanged()));
-}
-
-void MemcheckErrorView::resizeEvent(QResizeEvent *e)
-{
- emit resized();
- QListView::resizeEvent(e);
-}
-
-void MemcheckErrorView::setDefaultSuppressionFile(const QString &suppFile)
-{
- m_defaultSuppFile = suppFile;
-}
-
-QString MemcheckErrorView::defaultSuppressionFile() const
-{
- return m_defaultSuppFile;
-}
-
-// slot, can (for now) be invoked either when the settings were modified *or* when the active
-// settings object has changed.
-void MemcheckErrorView::settingsChanged(Analyzer::AnalyzerSettings *settings)
-{
- QTC_ASSERT(settings, return);
- m_settings = settings;
-}
-
-void MemcheckErrorView::contextMenuEvent(QContextMenuEvent *e)
-{
- const QModelIndexList indizes = selectionModel()->selectedRows();
- if (indizes.isEmpty())
- return;
-
- QList<Error> errors;
- foreach (const QModelIndex &index, indizes) {
- Error error = model()->data(index, ErrorListModel::ErrorRole).value<Error>();
- if (!error.suppression().isNull())
- errors << error;
- }
-
- QMenu menu;
- menu.addAction(m_copyAction);
- menu.addSeparator();
- menu.addAction(m_suppressAction);
- m_suppressAction->setEnabled(!errors.isEmpty());
- menu.exec(e->globalPos());
-}
-
-void MemcheckErrorView::suppressError()
-{
- SuppressionDialog *dialog = new SuppressionDialog(this);
- if (dialog->shouldShow()) {
- dialog->setModal(true);
- dialog->show();
- dialog->setAttribute(Qt::WA_DeleteOnClose, true);
- } else {
- delete dialog;
- }
-}
-
-} // namespace Internal
-} // namespace Memcheck
diff --git a/src/plugins/memcheck/memcheckerrorview.h b/src/plugins/memcheck/memcheckerrorview.h
deleted file mode 100644
index 00dfb2318f..0000000000
--- a/src/plugins/memcheck/memcheckerrorview.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@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 MEMCHECKERRORVIEW_H
-#define MEMCHECKERRORVIEW_H
-
-#include <QtGui/QListView>
-#include <QtGui/QStyledItemDelegate>
-#include <QtGui/QLabel>
-
-namespace Analyzer {
-class AnalyzerSettings;
-}
-
-namespace ProjectExplorer {
-class Project;
-}
-
-namespace Memcheck {
-namespace Internal {
-
-class MemcheckErrorDelegate : public QStyledItemDelegate
-{
- Q_OBJECT
-
-public:
- /// This delegate can only work on one view at a time, parent. parent will also be the parent
- /// in the QObject parent-child system.
- explicit MemcheckErrorDelegate(QListView *parent);
-
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
-
-public slots:
- void currentChanged(const QModelIndex &now, const QModelIndex &previous);
- void viewResized();
- void layoutChanged();
- void copy();
-
-private slots:
- void verticalScrolled();
- void openLinkInEditor(const QString &link);
-
-private:
- // the constness of this method is a necessary lie because it is called from paint() const.
- QWidget *createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const;
-
- static const int s_itemMargin = 2;
- mutable QPersistentModelIndex m_detailsIndex;
- mutable QWidget *m_detailsWidget;
- mutable int m_detailsWidgetHeight;
-};
-
-class MemcheckErrorView : public QListView
-{
- Q_OBJECT
-
-public:
- MemcheckErrorView(QWidget *parent = 0);
- ~MemcheckErrorView();
-
- // reimplemented to connect delegate to connection model after it has been set by
- // superclass implementation
- void setModel(QAbstractItemModel *model);
-
- void setDefaultSuppressionFile(const QString &suppFile);
- QString defaultSuppressionFile() const;
- Analyzer::AnalyzerSettings *settings() const { return m_settings; }
-
-signals:
- void resized();
-
-public slots:
- void settingsChanged(Analyzer::AnalyzerSettings *settings);
-
-private slots:
- void suppressError();
-
-protected:
- void resizeEvent(QResizeEvent *e);
- void contextMenuEvent(QContextMenuEvent *e);
-
-private:
- QAction *m_copyAction;
- QAction *m_suppressAction;
- QString m_defaultSuppFile;
- Analyzer::AnalyzerSettings *m_settings;
-};
-
-} // namespace Internal
-} // namespace Memcheck
-
-#endif // MEMCHECKERRORVIEW_H
diff --git a/src/plugins/memcheck/memcheckplugin.cpp b/src/plugins/memcheck/memcheckplugin.cpp
deleted file mode 100644
index d4038ca91f..0000000000
--- a/src/plugins/memcheck/memcheckplugin.cpp
+++ /dev/null
@@ -1,74 +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 "memcheckplugin.h"
-
-#include <analyzerbase/analyzermanager.h>
-#include <analyzerbase/analyzersettings.h>
-
-#include "memchecktool.h"
-#include "memchecksettings.h"
-
-#include <QtCore/QStringList>
-#include <QtCore/QtPlugin>
-
-using namespace Analyzer;
-using namespace Memcheck;
-
-using namespace Memcheck::Internal;
-
-static Analyzer::AbstractAnalyzerSubConfig *globalFactory()
-{
- return new MemcheckGlobalSettings();
-}
-
-static Analyzer::AbstractAnalyzerSubConfig *projectFactory()
-{
- return new MemcheckProjectSettings();
-}
-
-bool MemcheckPlugin::initialize(const QStringList &/*arguments*/, QString */*errorString*/)
-{
- AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalFactory, &projectFactory);
-
- AnalyzerManager::instance()->addTool(new MemcheckTool(this));
- return true;
-}
-
-
-void MemcheckPlugin::extensionsInitialized()
-{
-}
-
-Q_EXPORT_PLUGIN(MemcheckPlugin)
diff --git a/src/plugins/memcheck/memcheckplugin.h b/src/plugins/memcheck/memcheckplugin.h
deleted file mode 100644
index d310e90672..0000000000
--- a/src/plugins/memcheck/memcheckplugin.h
+++ /dev/null
@@ -1,57 +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 MEMCHECKPLUGIN_H
-#define MEMCHECKPLUGIN_H
-
-#include <extensionsystem/iplugin.h>
-
-namespace Memcheck {
-namespace Internal {
-
-class MemcheckPlugin : public ExtensionSystem::IPlugin
-{
- Q_OBJECT
-
-public:
- MemcheckPlugin() {}
-
- virtual bool initialize(const QStringList &arguments, QString *errorString);
- virtual void extensionsInitialized();
-};
-
-} // namespace Internal
-} // namespace Memcheck
-
-#endif // MEMCHECKPLUGIN_H
diff --git a/src/plugins/memcheck/memchecksettings.cpp b/src/plugins/memcheck/memchecksettings.cpp
deleted file mode 100644
index 66c609c83a..0000000000
--- a/src/plugins/memcheck/memchecksettings.cpp
+++ /dev/null
@@ -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 Memcheck {
-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 Memcheck
diff --git a/src/plugins/memcheck/memchecksettings.h b/src/plugins/memcheck/memchecksettings.h
deleted file mode 100644
index f01883a3b8..0000000000
--- a/src/plugins/memcheck/memchecksettings.h
+++ /dev/null
@@ -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 Memcheck {
-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 Memcheck
-
-#endif // ANALYZER_INTERNAL_MEMCHECKSETTINGS_H
diff --git a/src/plugins/memcheck/memchecktool.cpp b/src/plugins/memcheck/memchecktool.cpp
deleted file mode 100644
index 932584478f..0000000000
--- a/src/plugins/memcheck/memchecktool.cpp
+++ /dev/null
@@ -1,550 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@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 "memchecktool.h"
-#include "memcheckengine.h"
-#include "memcheckerrorview.h"
-#include "memchecksettings.h"
-
-#include <analyzerbase/analyzermanager.h>
-#include <analyzerbase/analyzerconstants.h>
-#include <analyzerbase/ianalyzeroutputpaneadapter.h>
-
-#include <valgrind/xmlprotocol/errorlistmodel.h>
-#include <valgrind/xmlprotocol/stackmodel.h>
-#include <valgrind/xmlprotocol/error.h>
-#include <valgrind/xmlprotocol/frame.h>
-#include <valgrind/xmlprotocol/stack.h>
-#include <valgrind/xmlprotocol/suppression.h>
-
-#include <valgrindtoolbase/valgrindsettings.h>
-
-#include <extensionsystem/iplugin.h>
-#include <extensionsystem/pluginmanager.h>
-
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/project.h>
-#include <projectexplorer/runconfiguration.h>
-#include <projectexplorer/target.h>
-#include <projectexplorer/session.h>
-#include <projectexplorer/buildconfiguration.h>
-
-#include <coreplugin/coreconstants.h>
-#include <coreplugin/icore.h>
-#include <coreplugin/actionmanager/actionmanager.h>
-#include <coreplugin/actionmanager/actioncontainer.h>
-#include <coreplugin/actionmanager/command.h>
-#include <coreplugin/uniqueidmanager.h>
-
-#include <texteditor/basetexteditor.h>
-
-#include <utils/fancymainwindow.h>
-#include <utils/styledbar.h>
-#include <utils/qtcassert.h>
-
-#include <QtCore/QString>
-#include <QtCore/QLatin1String>
-#include <QtCore/QFileInfo>
-#include <QtCore/QFile>
-#include <QtCore/QDir>
-
-#include <QtGui/QDockWidget>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QComboBox>
-#include <QtGui/QLabel>
-#include <QtGui/QSpinBox>
-#include <QtGui/QAction>
-#include <QtGui/QMenu>
-#include <QtGui/QMessageBox>
-#include <QtGui/QToolButton>
-#include <QtGui/QCheckBox>
-#include <utils/stylehelper.h>
-
-using namespace Analyzer;
-using namespace Valgrind::XmlProtocol;
-
-namespace Memcheck {
-namespace Internal {
-
-// Adapter for output pane.
-class MemCheckOutputPaneAdapter : public Analyzer::ListItemViewOutputPaneAdapter
-{
-public:
- explicit MemCheckOutputPaneAdapter(MemcheckTool *mct) :
- ListItemViewOutputPaneAdapter(mct), m_tool(mct) {}
-
- virtual QWidget *toolBarWidget() { return m_tool->createPaneToolBarWidget(); }
- virtual void clearContents() { m_tool->clearErrorView(); }
-
-protected:
- virtual QAbstractItemView *createItemView() { return m_tool->ensurePaneErrorView(); }
-
-private:
- MemcheckTool *m_tool;
-};
-
-// ---------------------------- MemcheckErrorFilterProxyModel
-MemcheckErrorFilterProxyModel::MemcheckErrorFilterProxyModel(QObject *parent)
- : QSortFilterProxyModel(parent),
- m_filterExternalIssues(false)
-{
-}
-
-void MemcheckErrorFilterProxyModel::setAcceptedKinds(const QList<int> &acceptedKinds)
-{
- if (m_acceptedKinds != acceptedKinds) {
- m_acceptedKinds = acceptedKinds;
- invalidate();
- }
-}
-
-void MemcheckErrorFilterProxyModel::setFilterExternalIssues(bool filter)
-{
- if (m_filterExternalIssues != filter) {
- m_filterExternalIssues = filter;
- invalidate();
- }
-}
-
-bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
-{
- // we only deal with toplevel items
- if (sourceParent.isValid())
- return true;
-
- // because toplevel items have no parent, we can't use sourceParent to find them. we just use
- // sourceParent as an invalid index, telling the model that the index we're looking for has no
- // parent.
- QAbstractItemModel *model = sourceModel();
- QModelIndex sourceIndex = model->index(sourceRow, filterKeyColumn(), sourceParent);
- if (!sourceIndex.isValid())
- return true;
-
- const Error error = sourceIndex.data(ErrorListModel::ErrorRole).value<Error>();
-
- // filter on kind
- if (!m_acceptedKinds.contains(error.kind()))
- return false;
-
- // filter non-project stuff
- if (m_filterExternalIssues && !error.stacks().isEmpty()) {
- // ALGORITHM: look at last five stack frames, if none of these is inside any open projects,
- // assume this error was created by an external library
- ProjectExplorer::SessionManager *session
- = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
- QSet<QString> validFolders;
- foreach (ProjectExplorer::Project *project, session->projects()) {
- validFolders << project->projectDirectory();
- foreach (ProjectExplorer::Target *target, project->targets()) {
- foreach (ProjectExplorer::BuildConfiguration *config, target->buildConfigurations()) {
- validFolders << config->buildDirectory();
- }
- }
- }
-
- const QVector< Frame > frames = error.stacks().first().frames();
-
- const int framesToLookAt = qMin(6, frames.size());
-
- bool inProject = false;
- for ( int i = 0; i < framesToLookAt; ++i ) {
- const Frame &frame = frames.at(i);
- foreach (const QString &folder, validFolders) {
- if (frame.object().startsWith(folder)) {
- inProject = true;
- break;
- }
- }
- }
- if (!inProject)
- return false;
- }
-
- return true;
-}
-
-static void initKindFilterAction(QAction *action, const QList<int> &kinds)
-{
- action->setCheckable(true);
- QVariantList data;
- foreach (int kind, kinds)
- data << kind;
- action->setData(data);
-}
-
-MemcheckTool::MemcheckTool(QObject *parent) :
- Analyzer::IAnalyzerTool(parent),
- m_settings(0),
- m_errorModel(0),
- m_errorProxyModel(0),
- m_errorView(0),
- m_filterProjectAction(new QAction(tr("External Errors"), this)),
- m_suppressionSeparator(new QAction(tr("Suppressions"), this)),
- m_outputPaneAdapter(0)
-{
- setObjectName(QLatin1String("MemcheckTool"));
- connect(ProjectExplorer::ProjectExplorerPlugin::instance(),
- SIGNAL(updateRunActions()), SLOT(maybeActiveRunConfigurationChanged()));
-
- QAction *a = new QAction(tr("Definite Memory Leaks"), this);
- initKindFilterAction(a, QList<int>() << Leak_DefinitelyLost << Leak_IndirectlyLost);
- m_errorFilterActions << a;
-
- a = new QAction(tr("Possible Memory Leaks"), this);
- initKindFilterAction(a, QList<int>() << Leak_PossiblyLost << Leak_StillReachable);
- m_errorFilterActions << a;
-
- a = new QAction(tr("Use of Uninitialized Memory"), this);
- initKindFilterAction(a, QList<int>() << InvalidRead << InvalidWrite << InvalidJump << Overlap
- << InvalidMemPool << UninitCondition << UninitValue
- << SyscallParam << ClientCheck);
- m_errorFilterActions << a;
-
- a = new QAction(tr("Invalid Frees"), this);
- initKindFilterAction(a, QList<int>() << InvalidFree << MismatchedFree);
- m_errorFilterActions << a;
-
- m_filterProjectAction->setToolTip(tr("Show issues originating outside currently opened projects."));
- m_filterProjectAction->setCheckable(true);
-
- m_suppressionSeparator->setSeparator(true);
- m_suppressionSeparator->setToolTip(tr("These suppression files were used in the last memory analyzer run."));
-}
-
-void MemcheckTool::settingsDestroyed(QObject *settings)
-{
- QTC_ASSERT(m_settings == settings, return);
- m_settings = AnalyzerGlobalSettings::instance();
-}
-
-void MemcheckTool::maybeActiveRunConfigurationChanged()
-{
- AnalyzerSettings *settings = 0;
- ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
- if (ProjectExplorer::Project *project = pe->startupProject()) {
- if (ProjectExplorer::Target *target = project->activeTarget()) {
- if (ProjectExplorer::RunConfiguration *rc = target->activeRunConfiguration()) {
- settings = rc->extraAspect<AnalyzerProjectSettings>();
- }
- }
- }
-
- if (!settings) // fallback to global settings
- settings = AnalyzerGlobalSettings::instance();
-
- if (m_settings == settings)
- return;
-
- // disconnect old settings class if any
- if (m_settings) {
- m_settings->disconnect(this);
- m_settings->disconnect(m_errorProxyModel);
- }
-
- // now make the new settings current, update and connect input widgets
- m_settings = settings;
- QTC_ASSERT(m_settings, return);
-
- connect(m_settings, SIGNAL(destroyed(QObject *)), SLOT(settingsDestroyed(QObject *)));
-
- AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>();
- QTC_ASSERT(memcheckSettings, return);
-
- foreach (QAction *action, m_errorFilterActions) {
- bool contained = true;
- foreach (const QVariant &v, action->data().toList()) {
- bool ok;
- int kind = v.toInt(&ok);
- if (ok && !memcheckSettings->visibleErrorKinds().contains(kind))
- contained = false;
- }
- action->setChecked(contained);
- }
-
- m_filterProjectAction->setChecked(!memcheckSettings->filterExternalIssues());
-
- m_errorView->settingsChanged(m_settings);
-
- connect(memcheckSettings, SIGNAL(visibleErrorKindsChanged(QList<int>)),
- m_errorProxyModel, SLOT(setAcceptedKinds(QList<int>)));
- m_errorProxyModel->setAcceptedKinds(memcheckSettings->visibleErrorKinds());
-
- connect(memcheckSettings, SIGNAL(filterExternalIssuesChanged(bool)),
- m_errorProxyModel, SLOT(setFilterExternalIssues(bool)));
- m_errorProxyModel->setFilterExternalIssues(memcheckSettings->filterExternalIssues());
-}
-
-QString MemcheckTool::id() const
-{
- return "Memcheck";
-}
-
-QString MemcheckTool::displayName() const
-{
- return tr("Analyze Memory");
-}
-
-IAnalyzerTool::ToolMode MemcheckTool::mode() const
-{
- return DebugMode;
-}
-
-class FrameFinder : public ErrorListModel::RelevantFrameFinder
-{
-public:
- Frame findRelevant(const Error &error) const
- {
- const QVector<Stack> stacks = error.stacks();
- if (stacks.isEmpty())
- return Frame();
- const Stack &stack = stacks[0];
- const QVector<Frame> frames = stack.frames();
- if (frames.isEmpty())
- return Frame();
-
- //find the first frame belonging to the project
- if (!m_projectFiles.isEmpty()) {
- foreach (const Frame &frame, frames) {
- if (frame.directory().isEmpty() || frame.file().isEmpty())
- continue;
-
- //filepaths can contain "..", clean them:
- const QString f = QFileInfo(frame.directory() + QLatin1Char('/') + frame.file()).absoluteFilePath();
- if (m_projectFiles.contains(f))
- return frame;
- }
- }
-
- //if no frame belonging to the project was found, return the first one that is not malloc/new
- foreach (const Frame &frame, frames) {
- if (!frame.functionName().isEmpty() && frame.functionName() != QLatin1String("malloc")
- && !frame.functionName().startsWith("operator new(") )
- {
- return frame;
- }
- }
-
- //else fallback to the first frame
- return frames.first();
- }
- void setFiles(const QStringList &files)
- {
- m_projectFiles = files;
- }
-private:
- QStringList m_projectFiles;
-};
-
-MemcheckErrorView *MemcheckTool::ensurePaneErrorView()
-{
- if (!m_errorView) {
- m_errorView = new MemcheckErrorView;
- m_errorView->setObjectName(QLatin1String("MemcheckErrorView"));
- m_errorView->setFrameStyle(QFrame::NoFrame);
- m_errorView->setAttribute(Qt::WA_MacShowFocusRect, false);
- m_errorModel = new ErrorListModel(m_errorView);
- m_frameFinder = new Internal::FrameFinder;
- m_errorModel->setRelevantFrameFinder(QSharedPointer<Internal::FrameFinder>(m_frameFinder));
- m_errorProxyModel = new MemcheckErrorFilterProxyModel(m_errorView);
- m_errorProxyModel->setSourceModel(m_errorModel);
- m_errorProxyModel->setDynamicSortFilter(true);
- m_errorView->setModel(m_errorProxyModel);
- m_errorView->setSelectionMode(QAbstractItemView::ExtendedSelection);
- // make m_errorView->selectionModel()->selectedRows() return something
- m_errorView->setSelectionBehavior(QAbstractItemView::SelectRows);
- m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- m_errorView->setAutoScroll(false);
- m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView");
- }
- return m_errorView;
-}
-
-QWidget *MemcheckTool::createPaneToolBarWidget()
-{
- QWidget *toolbarWidget = new QWidget;
- toolbarWidget->setObjectName(QLatin1String("MemCheckToolBarWidget"));
- QHBoxLayout *layout = new QHBoxLayout;
- layout->setMargin(0);
- layout->setSpacing(0);
- // filter
- QToolButton *filterButton = new QToolButton;
- filterButton->setIcon(QIcon(Core::Constants::ICON_FILTER));
- filterButton->setText(tr("Error Filter"));
- filterButton->setPopupMode(QToolButton::InstantPopup);
- QMenu *filterMenu = new QMenu(filterButton);
- foreach (QAction *filterAction, m_errorFilterActions)
- filterMenu->addAction(filterAction);
- filterMenu->addSeparator();
- filterMenu->addAction(m_filterProjectAction);
- filterMenu->addAction(m_suppressionSeparator);
- connect(filterMenu, SIGNAL(triggered(QAction *)), SLOT(updateErrorFilter()));
- filterButton->setMenu(filterMenu);
- layout->addWidget(filterButton);
- layout->addStretch();
- toolbarWidget->setLayout(layout);
- return toolbarWidget;
-}
-
-void MemcheckTool::initialize()
-{
- ensurePaneErrorView();
- // register shortcuts
- maybeActiveRunConfigurationChanged();
-}
-
-IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
-{
- m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()->project()->files(ProjectExplorer::Project::AllFiles) : QStringList());
-
- MemcheckEngine *engine = new MemcheckEngine(sp, runConfiguration);
-
- connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
- this, SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
- connect(engine, SIGNAL(parserError(Valgrind::XmlProtocol::Error)),
- this, SLOT(parserError(Valgrind::XmlProtocol::Error)));
- connect(engine, SIGNAL(internalParserError(QString)),
- this, SLOT(internalParserError(QString)));
- connect(engine, SIGNAL(finished()), this, SLOT(finished()));
- AnalyzerManager::instance()->showStatusMessage(AnalyzerManager::msgToolStarted(displayName()));
- return engine;
-}
-
-void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
-{
- clearErrorView();
-
- QString dir;
- if (ProjectExplorer::RunConfiguration *rc = engine->runConfiguration())
- dir = rc->target()->project()->projectDirectory() + QDir::separator();
-
- const MemcheckEngine *mEngine = dynamic_cast<const MemcheckEngine *>(engine);
- QTC_ASSERT(mEngine, return);
- const QString name = QFileInfo(mEngine->executable()).fileName();
-
- m_errorView->setDefaultSuppressionFile(dir + name + QLatin1String(".supp"));
-
- QMenu *menu = filterMenu();
- QTC_ASSERT(menu, return);
- foreach (const QString &file, mEngine->suppressionFiles()) {
- QAction *action = menu->addAction(QFileInfo(file).fileName());
- action->setToolTip(file);
- action->setData(file);
- connect(action, SIGNAL(triggered(bool)),
- this, SLOT(suppressionActionTriggered()));
- m_suppressionActions << action;
- }
-}
-
-QMenu *MemcheckTool::filterMenu() const
-{
- QTC_ASSERT(m_suppressionSeparator, return 0);
- foreach (QWidget *w, m_suppressionSeparator->associatedWidgets())
- if (QMenu *menu = qobject_cast<QMenu *>(w))
- return menu;
- return 0;
-}
-
-void MemcheckTool::suppressionActionTriggered()
-{
- QAction *action = qobject_cast<QAction *>(sender());
- QTC_ASSERT(action, return);
- const QString file = action->data().toString();
- QTC_ASSERT(!file.isEmpty(), return);
-
- TextEditor::BaseTextEditorWidget::openEditorAt(file, 0);
-}
-
-void MemcheckTool::parserError(const Valgrind::XmlProtocol::Error &error)
-{
- m_errorModel->addError(error);
-}
-
-void MemcheckTool::internalParserError(const QString &errorString)
-{
- QMessageBox::critical(m_errorView, tr("Internal Error"),
- tr("Error occurred parsing valgrind output: %1").arg(errorString));
-}
-
-void MemcheckTool::clearErrorView()
-{
- m_errorModel->clear();
-
- qDeleteAll(m_suppressionActions);
- m_suppressionActions.clear();
- QTC_ASSERT(filterMenu()->actions().last() == m_suppressionSeparator, qt_noop());
-}
-
-void MemcheckTool::updateErrorFilter()
-{
- QTC_ASSERT(m_settings, return);
-
- AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>();
- QTC_ASSERT(memcheckSettings, return);
- memcheckSettings->setFilterExternalIssues(!m_filterProjectAction->isChecked());
-
- QList<int> errorKinds;
- foreach (QAction *a, m_errorFilterActions) {
- if (!a->isChecked())
- continue;
- foreach (const QVariant &v, a->data().toList()) {
- bool ok;
- int kind = v.toInt(&ok);
- if (ok)
- errorKinds << kind;
- }
- }
- memcheckSettings->setVisibleErrorKinds(errorKinds);
-}
-
-IAnalyzerOutputPaneAdapter *MemcheckTool::outputPaneAdapter()
-{
- if (!m_outputPaneAdapter)
- m_outputPaneAdapter = new MemCheckOutputPaneAdapter(this);
- return m_outputPaneAdapter;
-}
-
-void MemcheckTool::finished()
-{
- const QString msg = AnalyzerManager::msgToolFinished(displayName(), m_errorModel->rowCount());
- AnalyzerManager::instance()->showStatusMessage(msg);
-}
-
-bool MemcheckTool::canRunRemotely() const
-{
- return true;
-}
-
-} // namespace Internal
-} // namespace Memcheck
diff --git a/src/plugins/memcheck/memchecktool.h b/src/plugins/memcheck/memchecktool.h
deleted file mode 100644
index 4895898cb1..0000000000
--- a/src/plugins/memcheck/memchecktool.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@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 MEMCHECKTOOL_H
-#define MEMCHECKTOOL_H
-
-#include <analyzerbase/ianalyzertool.h>
-
-#include <QtGui/QSortFilterProxyModel>
-#include <QtCore/QSharedPointer>
-
-QT_BEGIN_NAMESPACE
-class QItemSelection;
-class QTreeView;
-class QModelIndex;
-class QAction;
-class QSpinBox;
-class QCheckBox;
-class QMenu;
-QT_END_NAMESPACE
-
-namespace Valgrind {
-namespace XmlProtocol {
-class ErrorListModel;
-class Error;
-}
-}
-
-namespace Analyzer
-{
-class AnalyzerSettings;
-}
-
-namespace Memcheck {
-namespace Internal {
-
-class MemCheckOutputPaneAdapter;
-class MemcheckErrorView;
-class FrameFinder;
-
-class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-
-public:
- MemcheckErrorFilterProxyModel(QObject *parent = 0);
-
-public slots:
- void setAcceptedKinds(const QList<int> &acceptedKinds);
- void setFilterExternalIssues(bool filter);
-
-protected:
- bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
-
-private:
- QList<int> m_acceptedKinds;
- bool m_filterExternalIssues;
-};
-
-class MemcheckTool : public Analyzer::IAnalyzerTool
-{
- Q_OBJECT
-
-public:
- explicit MemcheckTool(QObject *parent = 0);
-
- QString id() const;
- QString displayName() const;
- ToolMode mode() const;
-
- void initialize();
- void extensionsInitialized() {}
-
- Analyzer::IAnalyzerOutputPaneAdapter *outputPaneAdapter();
- Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration = 0);
-
- // For the output pane adapter.
- MemcheckErrorView *ensurePaneErrorView();
- QWidget *createPaneToolBarWidget();
- void clearErrorView();
-
- bool canRunRemotely() const;
- bool needsOutputPane() const { return true; }
-
-private slots:
- void settingsDestroyed(QObject *settings);
- void maybeActiveRunConfigurationChanged();
-
- void engineStarting(const Analyzer::IAnalyzerEngine *engine);
- void finished();
-
- void parserError(const Valgrind::XmlProtocol::Error &error);
- void internalParserError(const QString &errorString);
- void updateErrorFilter();
- void suppressionActionTriggered();
-
-private:
- QMenu *filterMenu() const;
-
- Analyzer::AnalyzerSettings *m_settings;
-
- FrameFinder *m_frameFinder;
- Valgrind::XmlProtocol::ErrorListModel *m_errorModel;
- MemcheckErrorFilterProxyModel *m_errorProxyModel;
- MemcheckErrorView *m_errorView;
-
- QList<QAction *> m_errorFilterActions;
- QAction *m_filterProjectAction;
- QList<QAction *> m_suppressionActions;
- QAction *m_suppressionSeparator;
- MemCheckOutputPaneAdapter *m_outputPaneAdapter;
-};
-
-} // namespace Internal
-} // namespace Memcheck
-
-#endif // MEMCHECKTOOL_H
diff --git a/src/plugins/memcheck/suppressiondialog.cpp b/src/plugins/memcheck/suppressiondialog.cpp
deleted file mode 100644
index 481299416f..0000000000
--- a/src/plugins/memcheck/suppressiondialog.cpp
+++ /dev/null
@@ -1,259 +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 "suppressiondialog.h"
-#include "ui_suppressiondialog.h"
-
-#include "memcheckerrorview.h"
-#include "memchecksettings.h"
-
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/session.h>
-#include <projectexplorer/project.h>
-#include <projectexplorer/projectnodes.h>
-
-#include <utils/pathchooser.h>
-#include <utils/fileutils.h>
-#include <utils/qtcassert.h>
-
-#include <QtCore/QFile>
-#include <QtGui/QPushButton>
-
-#include <valgrind/xmlprotocol/suppression.h>
-#include <valgrind/xmlprotocol/errorlistmodel.h>
-#include <valgrind/xmlprotocol/stack.h>
-#include <valgrind/xmlprotocol/frame.h>
-
-using namespace Analyzer;
-using namespace Valgrind::XmlProtocol;
-
-namespace {
-
-QString suppressionText(const Error &error)
-{
- Suppression sup(error.suppression());
-
- // workaround: https://bugs.kde.org/show_bug.cgi?id=255822
- if (sup.frames().size() >= 24) {
- sup.setFrames(sup.frames().mid(0, 23));
- }
- QTC_ASSERT(sup.frames().size() < 24, qt_noop());
-
- // try to set some useful name automatically, instead of "insert_name_here"
- // we take the last stack frame and append the suppression kind, e.g.:
- // QDebug::operator<<(bool) [Memcheck:Cond]
- if (!error.stacks().isEmpty() && !error.stacks().first().frames().isEmpty()) {
- const Frame &frame = error.stacks().first().frames().first();
-
- QString newName;
- if (!frame.functionName().isEmpty())
- newName = frame.functionName();
- else if (!frame.object().isEmpty())
- newName = frame.object();
-
- if (!newName.isEmpty()) {
- sup.setName(newName + '[' + sup.kind() + ']');
- }
- }
-
- return sup.toString();
-}
-
-/// @p error input error, which might get hidden when it has the same stack
-/// @p suppressed the error that got suppressed already
-static bool equalSuppression(const Error &error, const Error &suppressed)
-{
- if (error.kind() != suppressed.kind() || error.suppression().isNull())
- return false;
-
- const SuppressionFrames errorFrames = error.suppression().frames();
- const SuppressionFrames suppressedFrames = suppressed.suppression().frames();
-
- // limit to 23 frames, see: https://bugs.kde.org/show_bug.cgi?id=255822
- if (qMin(23, suppressedFrames.size()) > errorFrames.size())
- return false;
-
- int frames = 23;
- if (errorFrames.size() < frames)
- frames = errorFrames.size();
-
- if (suppressedFrames.size() < frames)
- frames = suppressedFrames.size();
-
- for (int i = 0; i < frames; ++i) {
- if (errorFrames.at(i) != suppressedFrames.at(i))
- return false;
- }
-
- return true;
-}
-
-bool sortIndizesReverse(const QModelIndex &l, const QModelIndex &r)
-{
- return l.row() > r.row();
-}
-
-} // namespace anoe
-
-namespace Memcheck {
-namespace Internal {
-
-SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, QWidget *parent, Qt::WindowFlags f)
- : QDialog(parent, f),
- m_view(view),
- m_ui(new Ui::SuppressionDialog),
- m_settings(view->settings()),
- m_cleanupIfCanceled(false)
-{
- m_ui->setupUi(this);
-
- ///NOTE: pathchooser requires existing files...
- QFile defaultSuppFile(view->defaultSuppressionFile());
- if (!defaultSuppFile.exists()) {
- if (defaultSuppFile.open(QIODevice::WriteOnly)) {
- defaultSuppFile.close();
- m_cleanupIfCanceled = true;
- }
- }
-
- //NOTE: first set kind, then set path since otherwise the file will be seen as "invalid"
- m_ui->fileChooser->setExpectedKind(Utils::PathChooser::File);
- m_ui->fileChooser->setPath(defaultSuppFile.fileName());
- m_ui->fileChooser->setPromptDialogFilter(QLatin1String("*.supp"));
- m_ui->fileChooser->setPromptDialogTitle(tr("Select Suppression File"));
- connect(m_ui->fileChooser, SIGNAL(validChanged()),
- SLOT(validate()));
- connect(m_ui->suppressionEdit->document(), SIGNAL(contentsChanged()),
- SLOT(validate()));
-
- QString suppressions;
- QModelIndexList indizes = m_view->selectionModel()->selectedRows();
- if (indizes.isEmpty() && m_view->selectionModel()->currentIndex().isValid()) {
- // can happen when using arrow keys to navigate and shortcut to trigger suppression
- indizes << m_view->selectionModel()->currentIndex();
- }
- foreach (const QModelIndex &index, indizes) {
- Error error = m_view->model()->data(index, ErrorListModel::ErrorRole).value<Error>();
- if (!error.suppression().isNull())
- m_errors << error;
- }
-
- foreach (const Error &error, m_errors)
- suppressions += suppressionText(error);
-
- m_ui->suppressionEdit->setPlainText(suppressions);
-
- setWindowTitle(tr("Save Suppression"));
-}
-
-bool SuppressionDialog::shouldShow() const
-{
- return !m_errors.isEmpty();
-}
-
-void SuppressionDialog::accept()
-{
- const QString path = m_ui->fileChooser->path();
- QTC_ASSERT(!path.isEmpty(), return);
- QTC_ASSERT(!m_ui->suppressionEdit->toPlainText().trimmed().isEmpty(), return);
-
- Utils::FileSaver saver(path, QIODevice::Append);
- QTextStream stream(saver.file());
- stream << m_ui->suppressionEdit->toPlainText();
- saver.setResult(&stream);
- if (!saver.finalize(this))
- return;
-
- // add file to project (if there is a project that contains this file on the file system)
- ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
- if (!session->projectForFile(path)) {
- foreach (ProjectExplorer::Project *p, session->projects()) {
- if (path.startsWith(p->projectDirectory())) {
- p->rootProjectNode()->addFiles(ProjectExplorer::UnknownFileType, QStringList() << path);
- break;
- }
- }
- }
-
- m_settings->subConfig<AbstractMemcheckSettings>()->addSuppressionFiles(QStringList(path));
-
- QModelIndexList indizes = m_view->selectionModel()->selectedRows();
- qSort(indizes.begin(), indizes.end(), sortIndizesReverse);
- foreach (const QModelIndex &index, indizes) {
- bool removed = m_view->model()->removeRow(index.row());
- QTC_ASSERT(removed, qt_noop());
- Q_UNUSED(removed);
- }
-
- // one suppression might hide multiple rows, care for that
- for (int row = 0; row < m_view->model()->rowCount(); ++row ) {
- const Error rowError = m_view->model()->data(
- m_view->model()->index(row, 0), ErrorListModel::ErrorRole).value<Error>();
-
- foreach (const Error &error, m_errors) {
- if (equalSuppression(rowError, error)) {
- bool removed = m_view->model()->removeRow(row);
- QTC_ASSERT(removed, qt_noop());
- Q_UNUSED(removed);
- // gets increased in the for loop again
- --row;
- break;
- }
- }
- }
-
- // select a new item
- m_view->setCurrentIndex(indizes.first());
-
- QDialog::accept();
-}
-
-void SuppressionDialog::reject()
-{
- if (m_cleanupIfCanceled)
- QFile::remove(m_view->defaultSuppressionFile());
-
- QDialog::reject();
-}
-
-void SuppressionDialog::validate()
-{
- bool valid = m_ui->fileChooser->isValid()
- && !m_ui->suppressionEdit->toPlainText().trimmed().isEmpty();
-
- m_ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(valid);
-}
-
-} // namespace Internal
-} // namespace Memcheck
diff --git a/src/plugins/memcheck/suppressiondialog.h b/src/plugins/memcheck/suppressiondialog.h
deleted file mode 100644
index 0dc389e71f..0000000000
--- a/src/plugins/memcheck/suppressiondialog.h
+++ /dev/null
@@ -1,81 +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_VALGRIND_INTERNAL_SUPPRESSIONDIALOG_H
-#define ANALYZER_VALGRIND_INTERNAL_SUPPRESSIONDIALOG_H
-
-#include <QtGui/QDialog>
-
-#include <valgrind/xmlprotocol/error.h>
-
-namespace Analyzer {
-class AnalyzerSettings;
-}
-
-namespace Memcheck {
-namespace Internal {
-
-namespace Ui {
-class SuppressionDialog;
-}
-
-class MemcheckErrorView;
-
-class SuppressionDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit SuppressionDialog(MemcheckErrorView *view, QWidget *parent = 0,
- Qt::WindowFlags f = 0);
- virtual void accept();
- virtual void reject();
-
- bool shouldShow() const;
-
-private slots:
- void validate();
-
-private:
- MemcheckErrorView *m_view;
- Ui::SuppressionDialog *m_ui;
- Analyzer::AnalyzerSettings *m_settings;
- bool m_cleanupIfCanceled;
- QList<Valgrind::XmlProtocol::Error> m_errors;
-};
-
-} // namespace Internal
-} // namespace Memcheck
-
-#endif // ANALYZER_VALGRIND_INTERNAL_SUPPRESSIONDIALOG_H
diff --git a/src/plugins/memcheck/suppressiondialog.ui b/src/plugins/memcheck/suppressiondialog.ui
deleted file mode 100644
index 30302034a0..0000000000
--- a/src/plugins/memcheck/suppressiondialog.ui
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Memcheck::Internal::SuppressionDialog</class>
- <widget class="QDialog" name="Memcheck::Internal::SuppressionDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>718</width>
- <height>424</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="fileLabel">
- <property name="text">
- <string>Suppression File:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="Utils::PathChooser" name="fileChooser" native="true"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="suppressionsLabel">
- <property name="text">
- <string>Suppression:</string>
- </property>
- <property name="buddy">
- <cstring>suppressionEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QPlainTextEdit" name="suppressionEdit">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>1</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <family>Monospace</family>
- </font>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>Utils::PathChooser</class>
- <extends>QWidget</extends>
- <header location="global">utils/pathchooser.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>Memcheck::Internal::SuppressionDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>322</x>
- <y>391</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>Memcheck::Internal::SuppressionDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>254</x>
- <y>391</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>