2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-03-04 12:15:19 +01:00
|
|
|
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2011-03-04 12:15:19 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-03-04 12:15:19 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
#include "valgrindplugin.h"
|
2011-07-04 10:50:44 +02:00
|
|
|
|
|
|
|
|
#include "callgrindtool.h"
|
|
|
|
|
#include "memchecktool.h"
|
2013-07-19 16:08:54 +02:00
|
|
|
#include "valgrindruncontrolfactory.h"
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
#include <analyzerbase/analyzermanager.h>
|
2013-08-05 18:00:36 +02:00
|
|
|
#include <analyzerbase/analyzersettings.h>
|
|
|
|
|
|
|
|
|
|
#include <valgrind/valgrindsettings.h>
|
|
|
|
|
|
2012-08-23 15:53:58 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2011-05-23 13:50:28 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QtPlugin>
|
2011-03-04 12:15:19 +01:00
|
|
|
|
|
|
|
|
using namespace Analyzer;
|
2011-07-04 10:50:44 +02:00
|
|
|
|
|
|
|
|
namespace Valgrind {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-08-08 11:25:28 +02:00
|
|
|
class ProjectSettingsFactory : public AnalyzerSubConfigFactory
|
|
|
|
|
{
|
|
|
|
|
AbstractAnalyzerSubConfig *createProjectSettings()
|
|
|
|
|
{
|
|
|
|
|
return new ValgrindProjectSettings();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2013-08-07 19:47:30 +02:00
|
|
|
class ValgrindAction : public AnalyzerAction
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ValgrindAction() {}
|
|
|
|
|
};
|
|
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
2011-03-04 12:15:19 +01:00
|
|
|
{
|
2013-08-05 18:00:36 +02:00
|
|
|
AnalyzerGlobalSettings::registerConfig(new ValgrindGlobalSettings());
|
2013-08-08 11:25:28 +02:00
|
|
|
AnalyzerRunConfigurationAspect::registerConfigFactory(new ProjectSettingsFactory());
|
2013-08-05 18:00:36 +02:00
|
|
|
|
|
|
|
|
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
|
|
|
|
|
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
|
2013-08-07 19:47:30 +02:00
|
|
|
ValgrindAction *action = 0;
|
|
|
|
|
|
|
|
|
|
QString callgrindToolTip = tr("Valgrind Function Profile uses the "
|
|
|
|
|
"\"callgrind\" tool to record function calls when a program runs.");
|
|
|
|
|
|
|
|
|
|
QString memcheckToolTip = tr("Valgrind Analyze Memory uses the "
|
|
|
|
|
"\"memcheck\" tool to find memory leaks");
|
|
|
|
|
|
2013-08-05 18:18:34 +02:00
|
|
|
if (!Utils::HostOsInfo::isWindowsHost()) {
|
2013-08-07 19:47:30 +02:00
|
|
|
action = new ValgrindAction;
|
|
|
|
|
action->setId("Memcheck.Local");
|
|
|
|
|
action->setTool(memcheckTool);
|
|
|
|
|
action->setText(tr("Valgrind Memory Analyzer"));
|
|
|
|
|
action->setToolTip(memcheckToolTip);
|
|
|
|
|
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
|
|
|
|
action->setStartMode(StartLocal);
|
|
|
|
|
action->setEnabled(false);
|
|
|
|
|
AnalyzerManager::addAction(action);
|
|
|
|
|
|
|
|
|
|
action = new ValgrindAction;
|
|
|
|
|
action->setId("Callgrind.Local");
|
|
|
|
|
action->setTool(callgrindTool);
|
|
|
|
|
action->setText(tr("Valgrind Function Profiler"));
|
|
|
|
|
action->setToolTip(callgrindToolTip);
|
|
|
|
|
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
|
|
|
|
action->setStartMode(StartLocal);
|
|
|
|
|
action->setEnabled(false);
|
|
|
|
|
AnalyzerManager::addAction(action);
|
2013-08-05 18:18:34 +02:00
|
|
|
}
|
2013-08-07 19:47:30 +02:00
|
|
|
|
|
|
|
|
action = new ValgrindAction;
|
|
|
|
|
action->setId("Memcheck.Remote");
|
|
|
|
|
action->setTool(memcheckTool);
|
|
|
|
|
action->setText(tr("Valgrind Memory Analyzer (Remote)"));
|
|
|
|
|
action->setToolTip(memcheckToolTip);
|
|
|
|
|
action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
|
|
|
|
|
action->setStartMode(StartRemote);
|
|
|
|
|
AnalyzerManager::addAction(action);
|
|
|
|
|
|
|
|
|
|
action = new ValgrindAction;
|
|
|
|
|
action->setId("Callgrind.Remote");
|
|
|
|
|
action->setTool(callgrindTool);
|
|
|
|
|
action->setText(tr("Valgrind Function Profiler (Remote)"));
|
|
|
|
|
action->setToolTip(callgrindToolTip);
|
|
|
|
|
action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
|
|
|
|
|
action->setStartMode(StartRemote);
|
|
|
|
|
AnalyzerManager::addAction(action);
|
2011-03-04 12:15:19 +01:00
|
|
|
|
2013-07-19 16:08:54 +02:00
|
|
|
addAutoReleasedObject(new ValgrindRunControlFactory());
|
|
|
|
|
|
2011-06-30 13:44:22 +02:00
|
|
|
return true;
|
2011-03-04 12:15:19 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-04 10:50:44 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Valgrind
|
|
|
|
|
|
2011-07-04 18:34:18 +02:00
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
Q_EXPORT_PLUGIN(Valgrind::Internal::ValgrindPlugin)
|