forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.8'
Conflicts: src/plugins/cpptools/cppmodelmanager.cpp Change-Id: I0e69dfad951eb81d8008f5ca05e8fb6999ae2c8a
This commit is contained in:
@@ -29,7 +29,8 @@ HEADERS += \
|
||||
memcheckengine.h \
|
||||
memcheckerrorview.h \
|
||||
suppressiondialog.h \
|
||||
valgrindtool.h
|
||||
valgrindtool.h \
|
||||
valgrindruncontrolfactory.h
|
||||
|
||||
SOURCES += \
|
||||
valgrindplugin.cpp \
|
||||
@@ -52,7 +53,8 @@ SOURCES += \
|
||||
memcheckengine.cpp \
|
||||
memcheckerrorview.cpp \
|
||||
suppressiondialog.cpp \
|
||||
valgrindtool.cpp
|
||||
valgrindtool.cpp \
|
||||
valgrindruncontrolfactory.cpp
|
||||
|
||||
FORMS += \
|
||||
valgrindconfigwidget.ui
|
||||
|
||||
@@ -48,6 +48,8 @@ QtcPlugin {
|
||||
"valgrindplugin.h",
|
||||
"valgrindprocess.cpp",
|
||||
"valgrindprocess.h",
|
||||
"valgrindruncontrolfactory.cpp",
|
||||
"valgrindruncontrolfactory.h",
|
||||
"valgrindrunner.cpp",
|
||||
"valgrindrunner.h",
|
||||
"valgrindsettings.cpp",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "callgrindtool.h"
|
||||
#include "memchecktool.h"
|
||||
#include "valgrindruncontrolfactory.h"
|
||||
|
||||
#include <analyzerbase/analyzerconstants.h>
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
@@ -99,6 +100,8 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
AnalyzerManager::addTool(new MemcheckTool(this), modes);
|
||||
AnalyzerManager::addTool(new CallgrindTool(this), modes);
|
||||
|
||||
addAutoReleasedObject(new ValgrindRunControlFactory());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
86
src/plugins/valgrind/valgrindruncontrolfactory.cpp
Normal file
86
src/plugins/valgrind/valgrindruncontrolfactory.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** 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, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "valgrindruncontrolfactory.h"
|
||||
|
||||
#include <analyzerbase/ianalyzertool.h>
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzerstartparameters.h>
|
||||
#include <analyzerbase/analyzerruncontrol.h>
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Analyzer;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent) :
|
||||
IRunControlFactory(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
|
||||
{
|
||||
if (mode != CallgrindRunMode && mode != MemcheckRunMode)
|
||||
return false;
|
||||
IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
|
||||
if (tool)
|
||||
return tool->canRun(runConfiguration, mode);
|
||||
return false;
|
||||
}
|
||||
|
||||
RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
|
||||
{
|
||||
IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
|
||||
if (!tool) {
|
||||
if (errorMessage)
|
||||
*errorMessage = tr("No analyzer tool selected"); // never happens
|
||||
return 0;
|
||||
}
|
||||
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
|
||||
AnalyzerStartParameters sp = tool->createStartParameters(runConfiguration, mode);
|
||||
sp.toolId = tool->id();
|
||||
|
||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
|
||||
return rc;
|
||||
}
|
||||
|
||||
IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
|
||||
{
|
||||
Q_UNUSED(rc);
|
||||
return new AnalyzerRunConfigurationAspect;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
58
src/plugins/valgrind/valgrindruncontrolfactory.h
Normal file
58
src/plugins/valgrind/valgrindruncontrolfactory.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** 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, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef VALGRINDRUNCONTROLFACTORY_H
|
||||
#define VALGRINDRUNCONTROLFACTORY_H
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
class ValgrindRunControlFactory : public ProjectExplorer::IRunControlFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef ProjectExplorer::RunConfiguration RunConfiguration;
|
||||
|
||||
explicit ValgrindRunControlFactory(QObject *parent = 0);
|
||||
|
||||
// IRunControlFactory implementation
|
||||
bool canRun(RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
|
||||
|
||||
ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode,
|
||||
QString *errorMessage);
|
||||
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
#endif // VALGRINDRUNCONTROLFACTORY_H
|
||||
Reference in New Issue
Block a user