From a34719d43249c3e82a39e679486c5a5d0fda0d86 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 4 Mar 2011 12:15:18 +0100 Subject: [PATCH] Add valgrind base tool plugin. Merge-request: 260 Reviewed-by: hjk --- src/plugins/plugins.pro | 10 ++ .../ValgrindToolBase.pluginspec.in | 20 +++ .../valgrindtoolbase/valgrindconfigwidget.cpp | 75 +++++++++ .../valgrindtoolbase/valgrindconfigwidget.h | 76 +++++++++ .../valgrindtoolbase/valgrindconfigwidget.ui | 54 +++++++ src/plugins/valgrindtoolbase/valgrindengine.cpp | 174 +++++++++++++++++++++ src/plugins/valgrindtoolbase/valgrindengine.h | 94 +++++++++++ src/plugins/valgrindtoolbase/valgrindsettings.cpp | 106 +++++++++++++ src/plugins/valgrindtoolbase/valgrindsettings.h | 84 ++++++++++ src/plugins/valgrindtoolbase/valgrindtoolbase.pri | 5 + src/plugins/valgrindtoolbase/valgrindtoolbase.pro | 27 ++++ .../valgrindtoolbase_dependencies.pri | 3 + .../valgrindtoolbase/valgrindtoolbase_global.h | 47 ++++++ .../valgrindtoolbase/valgrindtoolbaseplugin.cpp | 71 +++++++++ .../valgrindtoolbase/valgrindtoolbaseplugin.h | 59 +++++++ 15 files changed, 905 insertions(+) create mode 100644 src/plugins/valgrindtoolbase/ValgrindToolBase.pluginspec.in create mode 100644 src/plugins/valgrindtoolbase/valgrindconfigwidget.cpp create mode 100644 src/plugins/valgrindtoolbase/valgrindconfigwidget.h create mode 100644 src/plugins/valgrindtoolbase/valgrindconfigwidget.ui create mode 100644 src/plugins/valgrindtoolbase/valgrindengine.cpp create mode 100644 src/plugins/valgrindtoolbase/valgrindengine.h create mode 100644 src/plugins/valgrindtoolbase/valgrindsettings.cpp create mode 100644 src/plugins/valgrindtoolbase/valgrindsettings.h create mode 100644 src/plugins/valgrindtoolbase/valgrindtoolbase.pri create mode 100644 src/plugins/valgrindtoolbase/valgrindtoolbase.pro create mode 100644 src/plugins/valgrindtoolbase/valgrindtoolbase_dependencies.pri create mode 100644 src/plugins/valgrindtoolbase/valgrindtoolbase_global.h create mode 100644 src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.cpp create mode 100644 src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.h diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 86ce393d8a..9e7a2aa701 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -42,6 +42,10 @@ SUBDIRS = plugin_coreplugin \ plugin_macros \ debugger/dumper.pro +!win32 { + SUBDIRS += plugin_valgrindtoolbase +} + linux-* { SUBDIRS += debugger/ptracepreload.pro } @@ -247,6 +251,12 @@ plugin_analyzerbase.subdir = analyzerbase plugin_analyzerbase.depends = plugin_coreplugin plugin_analyzerbase.depends += plugin_projectexplorer +!win32 { + plugin_valgrindtoolbase.subdir = valgrindtoolbase + plugin_valgrindtoolbase.depends = plugin_coreplugin + plugin_valgrindtoolbase.depends += plugin_analyzerbase +} + plugin_qmljstools.subdir = qmljstools plugin_qmljstools.depends = plugin_projectexplorer plugin_qmljstools.depends += plugin_coreplugin diff --git a/src/plugins/valgrindtoolbase/ValgrindToolBase.pluginspec.in b/src/plugins/valgrindtoolbase/ValgrindToolBase.pluginspec.in new file mode 100644 index 0000000000..2dcd6ed59e --- /dev/null +++ b/src/plugins/valgrindtoolbase/ValgrindToolBase.pluginspec.in @@ -0,0 +1,20 @@ + + Nokia Corporation + (C) 2011 Nokia Corporation + +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. + + Code Analyzer + Valgrind Tool Base Plugin + http://qt.nokia.com + + + + + diff --git a/src/plugins/valgrindtoolbase/valgrindconfigwidget.cpp b/src/plugins/valgrindtoolbase/valgrindconfigwidget.cpp new file mode 100644 index 0000000000..7e03254b6d --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindconfigwidget.cpp @@ -0,0 +1,75 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "valgrindconfigwidget.h" + +#include "ui_valgrindconfigwidget.h" + +#include "valgrindsettings.h" + +#include + +using namespace Analyzer::Internal; + +ValgrindConfigWidget::ValgrindConfigWidget(ValgrindSettings *settings, QWidget *parent) + : QWidget(parent), + m_settings(settings), + m_ui(new Ui::ValgrindConfigWidget) +{ + m_ui->setupUi(this); + + m_ui->valgrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); + m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command")); + + m_ui->valgrindExeChooser->setPath(m_settings->valgrindExecutable()); + connect(m_ui->valgrindExeChooser, SIGNAL(changed(QString)), SLOT(setValgrindExe(QString))); + connect(m_settings, SIGNAL(valgrindExecutableChanged(QString)), SLOT(setValgrindExe(QString))); +} + +ValgrindConfigWidget::~ValgrindConfigWidget() +{ + delete m_ui; +} + +void ValgrindConfigWidget::setValgrindExe(const QString &exe) +{ + m_ui->valgrindExeChooser->setPath(exe); + m_settings->setValgrindExecutable(exe); +} + +QString ValgrindConfigWidget::valgrindExe() const +{ + return m_ui->valgrindExeChooser->path(); +} diff --git a/src/plugins/valgrindtoolbase/valgrindconfigwidget.h b/src/plugins/valgrindtoolbase/valgrindconfigwidget.h new file mode 100644 index 0000000000..9157b87da3 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindconfigwidget.h @@ -0,0 +1,76 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + + +#ifndef ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H +#define ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { +class ValgrindConfigWidget; +} +QT_END_NAMESPACE + +namespace Analyzer { +namespace Internal { + +class ValgrindSettings; + +class ValgrindConfigWidget : public QWidget +{ + Q_OBJECT + +public: + ValgrindConfigWidget(ValgrindSettings *settings, QWidget *parent); + virtual ~ValgrindConfigWidget(); + + // ### remove the following? + QString valgrindExe() const; + +public slots: + void setValgrindExe(const QString &exe); + +private: + ValgrindSettings *m_settings; + Ui::ValgrindConfigWidget *m_ui; +}; + +} + +} + +#endif // ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H diff --git a/src/plugins/valgrindtoolbase/valgrindconfigwidget.ui b/src/plugins/valgrindtoolbase/valgrindconfigwidget.ui new file mode 100644 index 0000000000..385dc8043c --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindconfigwidget.ui @@ -0,0 +1,54 @@ + + + ValgrindConfigWidget + + + + 0 + 0 + 445 + 543 + + + + + + + + 0 + 1 + + + + Common Valgrind Options + + + + QFormLayout::ExpandingFieldsGrow + + + + + Valgrind executable: + + + + + + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/src/plugins/valgrindtoolbase/valgrindengine.cpp b/src/plugins/valgrindtoolbase/valgrindengine.cpp new file mode 100644 index 0000000000..dcb307f7b0 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindengine.cpp @@ -0,0 +1,174 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "valgrindengine.h" +#include "valgrindsettings.h" + +#include +#include +#include +#include +#include + +#define VALGRIND_DEBUG_OUTPUT 0 + +using namespace Analyzer; +using namespace Analyzer::Internal; +using namespace Utils; + +ValgrindEngine::ValgrindEngine(ProjectExplorer::RunConfiguration *runConfiguration) + : IAnalyzerEngine(runConfiguration), + m_settings(0), + m_progress(new QFutureInterface()) , + m_isStopping(false) +{ + ProjectExplorer::LocalApplicationRunConfiguration *localAppConfig = + qobject_cast(runConfiguration); + + m_settings = runConfiguration->extraAspect(); + if (!localAppConfig || !m_settings) + return; + + m_workingDirectory = localAppConfig->workingDirectory(); + m_executable = localAppConfig->executable(); + m_commandLineArguments = localAppConfig->commandLineArguments(); + m_environment = localAppConfig->environment(); +} + +ValgrindEngine::~ValgrindEngine() +{ + delete m_progress; +} + +void ValgrindEngine::start() +{ + emit starting(this); + + Core::ICore::instance()->progressManager()->addTask(m_progress->future(), + progressTitle(), "valgrind"); + m_progress->reportStarted(); + +#if VALGRIND_DEBUG_OUTPUT + emit standardOutputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" "))); + emit standardOutputReceived(tr("Working directory: %1").arg(m_workingDirectory)); + emit standardOutputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments)); +#endif + + runner()->setWorkingDirectory(m_workingDirectory); + runner()->setValgrindExecutable(m_settings->subConfig()->valgrindExecutable()); + runner()->setValgrindArguments(toolArguments()); + runner()->setDebuggeeExecutable(m_executable); + // note that m_commandLineArguments may contain several arguments in one string + runner()->setDebuggeeArguments(m_commandLineArguments); + runner()->setEnvironment(m_environment); + + connect(runner(), SIGNAL(standardOutputReceived(QByteArray)), + SLOT(receiveStandardOutput(QByteArray))); + connect(runner(), SIGNAL(standardErrorReceived(QByteArray)), + SLOT(receiveStandardError(QByteArray))); + connect(runner(), SIGNAL(processErrorReceived(QString, QProcess::ProcessError)), + SLOT(receiveProcessError(QString, QProcess::ProcessError))); + connect(runner(), SIGNAL(finished()), + SLOT(runnerFinished())); + + runner()->start(); +} + +void ValgrindEngine::stop() +{ + m_isStopping = true; + runner()->stop(); +} + +QString ValgrindEngine::executable() const +{ + return m_executable; +} + +void ValgrindEngine::runnerFinished() +{ + emit standardOutputReceived(tr("** Analysing finished **")); + emit finished(); + + m_progress->reportFinished(); + + disconnect(runner(), SIGNAL(standardOutputReceived(QByteArray)), + this, SLOT(receiveStandardOutput(QByteArray))); + disconnect(runner(), SIGNAL(standardErrorReceived(QByteArray)), + this, SLOT(receiveStandardError(QByteArray))); + disconnect(runner(), SIGNAL(processErrorReceived(QString, QProcess::ProcessError)), + this, SLOT(receiveProcessError(QString, QProcess::ProcessError))); + disconnect(runner(), SIGNAL(finished()), + this, SLOT(runnerFinished())); +} + +void ValgrindEngine::receiveStandardOutput(const QByteArray &b) +{ + emit standardOutputReceived(QString::fromLocal8Bit(b)); +} + +void ValgrindEngine::receiveStandardError(const QByteArray &b) +{ + emit standardErrorReceived(QString::fromLocal8Bit(b)); +} + +void ValgrindEngine::receiveProcessError(const QString &error, QProcess::ProcessError e) +{ + if (e == QProcess::FailedToStart) { + const QString &valgrind = m_settings->subConfig()->valgrindExecutable(); + if (!valgrind.isEmpty()) { + emit standardErrorReceived(tr("** Error: \"%1\" could not be started: %2 **").arg(valgrind).arg(error)); + } else { + emit standardErrorReceived(tr("** Error: no valgrind executable set **")); + } + } else if (m_isStopping && e == QProcess::Crashed) { // process gets killed on stop + emit standardErrorReceived(tr("** Process Terminated **")); + } else { + emit standardErrorReceived(QString("** %1 **").arg(error)); + } + + if (m_isStopping) + return; + + ///FIXME: get a better API for this into Qt Creator + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + QList< Core::IOutputPane *> panes = pm->getObjects(); + foreach(Core::IOutputPane *pane, panes) { + if (pane->displayName() == tr("Application Output")) { + pane->popup(false); + break; + } + } +} diff --git a/src/plugins/valgrindtoolbase/valgrindengine.h b/src/plugins/valgrindtoolbase/valgrindengine.h new file mode 100644 index 0000000000..0c5deaf5ff --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindengine.h @@ -0,0 +1,94 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef VALGRINDENGINE_H +#define VALGRINDENGINE_H + +#include "valgrindtoolbase_global.h" +#include "ianalyzerengine.h" + +#include + +#include + +#include +#include +#include + +namespace Analyzer { + +class AnalyzerSettings; + +namespace Internal { + +class VALGRINDTOOLBASE_EXPORT ValgrindEngine : public IAnalyzerEngine +{ + Q_OBJECT +public: + explicit ValgrindEngine(ProjectExplorer::RunConfiguration *runConfiguration); + virtual ~ValgrindEngine(); + + void start(); + void stop(); + + QString executable() const; + +protected: + virtual QString progressTitle() const = 0; + virtual QStringList toolArguments() const = 0; + virtual Valgrind::ValgrindRunner* runner() = 0; + + AnalyzerSettings *m_settings; + QFutureInterface *m_progress; + +private slots: + void runnerFinished(); + + void receiveStandardOutput(const QByteArray &); + void receiveStandardError(const QByteArray &); + void receiveProcessError(const QString &, QProcess::ProcessError); + +private: + QString m_workingDirectory; + QString m_executable; + QString m_commandLineArguments; + Utils::Environment m_environment; + bool m_isStopping; +}; + +} // namespace Internal +} // namespace Analyzer + +#endif // VALGRINDENGINE_H diff --git a/src/plugins/valgrindtoolbase/valgrindsettings.cpp b/src/plugins/valgrindtoolbase/valgrindsettings.cpp new file mode 100644 index 0000000000..9251c11b02 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindsettings.cpp @@ -0,0 +1,106 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "valgrindsettings.h" + +#include "valgrindconfigwidget.h" + +#include +#include + +#include + +using namespace Analyzer::Internal; +using namespace Analyzer; + +static const QLatin1String groupC("Analyzer"); + +static const QLatin1String valgrindExeC("Analyzer.Valgrind.ValgrindExecutable"); + +ValgrindSettings::ValgrindSettings() +{ +} + +ValgrindSettings::~ValgrindSettings() +{} + +QVariantMap ValgrindSettings::defaults() const +{ + QVariantMap map; + map.insert(valgrindExeC, QLatin1String("valgrind")); + return map; +} + +bool ValgrindSettings::fromMap(const QVariantMap &map) +{ + setIfPresent(map, valgrindExeC, &m_valgrindExecutable); + return true; +} + +QVariantMap ValgrindSettings::toMap() const +{ + QVariantMap map; + map.insert(valgrindExeC, m_valgrindExecutable); + + return map; +} + +void ValgrindSettings::setValgrindExecutable(const QString &valgrindExecutable) +{ + if (m_valgrindExecutable != valgrindExecutable) { + m_valgrindExecutable = valgrindExecutable; + emit valgrindExecutableChanged(valgrindExecutable); + } +} + +QString ValgrindSettings::valgrindExecutable() const +{ + return m_valgrindExecutable; +} + +QString ValgrindSettings::id() const +{ + return "Analyzer.Valgrind.Settings.Generic"; +} + +QString ValgrindSettings::displayName() const +{ + return tr("Generic Settings"); +} + +QWidget *ValgrindSettings::createConfigWidget(QWidget *parent) +{ + return new ValgrindConfigWidget(this, parent); +} diff --git a/src/plugins/valgrindtoolbase/valgrindsettings.h b/src/plugins/valgrindtoolbase/valgrindsettings.h new file mode 100644 index 0000000000..fb535633c4 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindsettings.h @@ -0,0 +1,84 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef ANALYZER_INTERNAL_VALGRINDSETTINGS_H +#define ANALYZER_INTERNAL_VALGRINDSETTINGS_H + +#include + +#include "valgrindtoolbase_global.h" + +#include +#include + +namespace Analyzer { +namespace Internal { + +/** + * Generic Valgrind settings shared by all tools. + */ +class VALGRINDTOOLBASE_EXPORT ValgrindSettings : public AbstractAnalyzerSubConfig +{ + Q_OBJECT +public: + ValgrindSettings(); + virtual ~ValgrindSettings(); + + virtual QVariantMap toMap() const; + virtual QVariantMap defaults() const; + + QString valgrindExecutable() const; + + virtual QString id() const; + virtual QString displayName() const; + virtual QWidget *createConfigWidget(QWidget *parent); + +public slots: + void setValgrindExecutable(const QString &); + +signals: + void valgrindExecutableChanged(const QString &); + +protected: + virtual bool fromMap(const QVariantMap &map); + +private: + QString m_valgrindExecutable; +}; + +} +} + +#endif // VALGRIND_INTERNAL_ANALZYZERSETTINGS_H diff --git a/src/plugins/valgrindtoolbase/valgrindtoolbase.pri b/src/plugins/valgrindtoolbase/valgrindtoolbase.pri new file mode 100644 index 0000000000..22fc88f3e3 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindtoolbase.pri @@ -0,0 +1,5 @@ +include(valgrindtoolbase_dependencies.pri) + +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD +LIBS *= -l$$qtLibraryName(ValgrindToolBase) diff --git a/src/plugins/valgrindtoolbase/valgrindtoolbase.pro b/src/plugins/valgrindtoolbase/valgrindtoolbase.pro new file mode 100644 index 0000000000..45ca6d694c --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindtoolbase.pro @@ -0,0 +1,27 @@ +TEMPLATE = lib +TARGET = ValgrindToolBase + +DEFINES += VALGRINDTOOLBASE_LIBRARY + +include(../../qtcreatorplugin.pri) +include(valgrindtoolbase_dependencies.pri) + +QT += network + +# Valgrind Tool Base files + +HEADERS += \ + valgrindtoolbaseplugin.h \ + valgrindtoolbase_global.h \ + valgrindengine.h \ + valgrindconfigwidget.h \ + valgrindsettings.h + +SOURCES += \ + valgrindtoolbaseplugin.cpp \ + valgrindengine.cpp \ + valgrindconfigwidget.cpp \ + valgrindsettings.cpp + +FORMS += \ + valgrindconfigwidget.ui diff --git a/src/plugins/valgrindtoolbase/valgrindtoolbase_dependencies.pri b/src/plugins/valgrindtoolbase/valgrindtoolbase_dependencies.pri new file mode 100644 index 0000000000..702132b903 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindtoolbase_dependencies.pri @@ -0,0 +1,3 @@ +include(../../plugins/coreplugin/coreplugin.pri) +include(../../plugins/analyzerbase/analyzerbase.pri) +include(../../libs/valgrind/valgrind.pri) \ No newline at end of file diff --git a/src/plugins/valgrindtoolbase/valgrindtoolbase_global.h b/src/plugins/valgrindtoolbase/valgrindtoolbase_global.h new file mode 100644 index 0000000000..ac24f1d266 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindtoolbase_global.h @@ -0,0 +1,47 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef VALGRINDTOOLBASE_GLOBAL_H +#define VALGRINDTOOLBASE_GLOBAL_H + +#include + +#if defined(VALGRINDTOOLBASE_LIBRARY) +# define VALGRINDTOOLBASE_EXPORT Q_DECL_EXPORT +#else +# define VALGRINDTOOLBASE_EXPORT Q_DECL_IMPORT +#endif + +#endif // VALGRINDTOOLBASE_GLOBAL_H diff --git a/src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.cpp b/src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.cpp new file mode 100644 index 0000000000..bdf546b962 --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.cpp @@ -0,0 +1,71 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "valgrindtoolbaseplugin.h" + +#include "valgrindsettings.h" + +#include + +#include +#include + +using namespace Analyzer; +using namespace Analyzer::Internal; + +ValgrindToolbasePlugin::ValgrindToolbasePlugin() +{ + +} + +ValgrindToolbasePlugin::~ValgrindToolbasePlugin() +{ + +} + +bool ValgrindToolbasePlugin::initialize(const QStringList &/*arguments*/, QString */*errorString*/) +{ + typedef AnalyzerSubConfigFactory ValgrindConfigFactory; + AnalyzerGlobalSettings::instance()->registerSubConfigFactory(new ValgrindConfigFactory); + return true; +} + + +void ValgrindToolbasePlugin::extensionsInitialized() +{ + +} + +Q_EXPORT_PLUGIN(ValgrindToolbasePlugin) \ No newline at end of file diff --git a/src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.h b/src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.h new file mode 100644 index 0000000000..a961859cfb --- /dev/null +++ b/src/plugins/valgrindtoolbase/valgrindtoolbaseplugin.h @@ -0,0 +1,59 @@ +/************************************************************************** +** +** 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 (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef VALGRINDTOOLBASEPLUGIN_H +#define VALGRINDTOOLBASEPLUGIN_H + +#include + +namespace Analyzer { +namespace Internal { + +class ValgrindToolbasePlugin : public ExtensionSystem::IPlugin +{ + Q_OBJECT + +public: + ValgrindToolbasePlugin(); + ~ValgrindToolbasePlugin(); + + virtual bool initialize(const QStringList &arguments, QString *errorString); + virtual void extensionsInitialized(); +}; + +} // namespace Internal +} + +#endif // VALGRINDTOOLBASEPLUGIN_H -- 2.11.0