Skip to content
Snippets Groups Projects
Commit 413198d5 authored by Christian Kandeler's avatar Christian Kandeler Committed by Daniel Teske
Browse files

RemoteLinux: Reverse direction of analyzer dependency.

The way the analyzer plugin runs applications is a complete mess.
While it may make sense conceptually to let the respective plugin
handle the messy details (as it is done for the debug mode), the current
analyzer approach is not designed for that.

Change-Id: I00f0fdda823c45760d5591d0481d2b293c38dc89
Reviewed-on: http://codereview.qt.nokia.com/270


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 362d4434
No related branches found
No related tags found
No related merge requests found
......@@ -16,5 +16,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<dependencyList>
<dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"RemoteLinux\" version=\"$$QTCREATOR_VERSION\"/>
</dependencyList>
</plugin>
include(../../plugins/coreplugin/coreplugin.pri)
include(../../libs/cplusplus/cplusplus.pri)
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/remotelinux/remotelinux.pri)
......@@ -41,6 +41,8 @@
#include <projectexplorer/applicationrunconfiguration.h>
#include <remotelinux/remotelinuxrunconfiguration.h>
#include <QtCore/QDebug>
using namespace Analyzer;
......@@ -65,6 +67,23 @@ AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *
return sp;
}
AnalyzerStartParameters remoteLinuxStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
{
AnalyzerStartParameters sp;
RemoteLinux::RemoteLinuxRunConfiguration * const rc
= qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration);
QTC_ASSERT(rc, return sp);
sp.debuggee = rc->remoteExecutableFilePath();
sp.debuggeeArgs = rc->arguments();
sp.connParams = rc->deviceConfig()->sshParameters();
sp.analyzerCmdPrefix = rc->commandPrefix();
sp.startMode = StartRemote;
sp.displayName = rc->displayName();
return sp;
}
// AnalyzerRunControlFactory ////////////////////////////////////////////////////
AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent)
: IRunControlFactory(parent)
......@@ -73,19 +92,19 @@ AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent)
bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
{
if (!qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration))
return false;
return mode == Constants::MODE_ANALYZE;
return runConfiguration->isEnabled() && mode == Constants::MODE_ANALYZE
&& (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)
|| qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration));
}
ProjectExplorer::RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration,
const QString &mode)
{
if (!qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration) ||
mode != Constants::MODE_ANALYZE) {
return 0;
}
const AnalyzerStartParameters sp = localStartParameters(runConfiguration);
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
const AnalyzerStartParameters sp
= qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)
? localStartParameters(runConfiguration) : remoteLinuxStartParameters(runConfiguration);
return create(sp, runConfiguration);
}
......
......@@ -14,7 +14,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<category>Device Support</category>
<url>http://qt.nokia.com</url>
<dependencyList>
<dependency name=\"AnalyzerBase\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"Debugger\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** 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 "maemoanalyzersupport.h"
#include "maemoglobal.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <analyzerbase/analyzerconstants.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <QtCore/QDir>
using namespace Utils;
using namespace Analyzer;
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(RemoteLinuxRunConfiguration *runConfig)
{
AnalyzerStartParameters params;
const LinuxDeviceConfiguration::ConstPtr &devConf = runConfig->deviceConfig();
params.debuggee = runConfig->remoteExecutableFilePath();
params.debuggeeArgs = runConfig->arguments();
params.analyzerCmdPrefix = MaemoGlobal::remoteCommandPrefix(devConf->osVersion(),
devConf->sshParameters().userName, runConfig->remoteExecutableFilePath())
+ MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges());
params.startMode = StartRemote;
params.connParams = devConf->sshParameters();
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
params.remoteMountPoint = runConfig->remoteProjectSourcesMountPoint();
const QString execDirAbs
= QDir::fromNativeSeparators(QFileInfo(runConfig->localExecutableFilePath()).path());
const QString execDirRel
= QDir(params.localMountDir).relativeFilePath(execDirAbs);
params.remoteSourcesDir = QString(params.remoteMountPoint
+ QLatin1Char('/') + execDirRel).toUtf8();
params.displayName = runConfig->displayName();
return AnalyzerManager::instance()->createAnalyzer(params, runConfig);
}
} // namespace Internal
} // namespace RemoteLinux
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** 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 MAEMOANALYZERSUPPORT_H
#define MAEMOANALYZERSUPPORT_H
#include "remotelinuxrunconfiguration.h"
namespace RemoteLinux {
namespace Internal {
namespace MaemoAnalyzerSupport {
ProjectExplorer::RunControl *createAnalyzerRunControl(RemoteLinuxRunConfiguration *runConfig);
}
} // namespace Internal
} // namespace RemoteLinux
#endif // MAEMOANALYZERSUPPORT_H
......@@ -33,7 +33,6 @@
#include "maemoconstants.h"
#include "maemodebugsupport.h"
#include "maemoanalyzersupport.h"
#include "maemoglobal.h"
#include "maemoremotemountsmodel.h"
#include "remotelinuxrunconfiguration.h"
......@@ -44,7 +43,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <debugger/debuggerconstants.h>
#include <qt4projectmanager/qt4project.h>
#include <analyzerbase/analyzerconstants.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
......@@ -171,15 +169,12 @@ RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig,
const QString &mode)
{
Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE
|| mode == Debugger::Constants::DEBUGMODE
|| mode == Analyzer::Constants::MODE_ANALYZE);
|| mode == Debugger::Constants::DEBUGMODE);
Q_ASSERT(canRun(runConfig, mode));
RemoteLinuxRunConfiguration *rc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig);
Q_ASSERT(rc);
if (mode == ProjectExplorer::Constants::RUNMODE)
return new MaemoRunControl(rc);
if (mode == Analyzer::Constants::MODE_ANALYZE)
return MaemoAnalyzerSupport::createAnalyzerRunControl(rc);
return MaemoDebugSupport::createDebugRunControl(rc);
}
......
......@@ -30,7 +30,6 @@ HEADERS += \
maemoglobal.h \
maemosshrunner.h \
maemodebugsupport.h \
maemoanalyzersupport.h \
maemoremotemountsmodel.h \
maemodeviceenvreader.h \
maemomountspecification.h \
......@@ -95,7 +94,6 @@ SOURCES += \
maemoglobal.cpp \
maemosshrunner.cpp \
maemodebugsupport.cpp \
maemoanalyzersupport.cpp \
maemoremotemountsmodel.cpp \
maemodeviceenvreader.cpp \
maemomountspecification.cpp \
......
include(../../plugins/analyzerbase/analyzerbase.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/debugger/debugger.pri)
include(../../plugins/projectexplorer/projectexplorer.pri)
......
......@@ -43,8 +43,6 @@
#include "qt4maemotarget.h"
#include "maemoqtversion.h"
#include <analyzerbase/analyzerconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
......@@ -415,7 +413,7 @@ bool RemoteLinuxRunConfiguration::hasEnoughFreePorts(const QString &mode) const
? remoteMounts()->validMountSpecificationCount() : 0;
if (mode == Debugger::Constants::DEBUGMODE)
return freePortCount >= mountDirCount + portsUsedByDebuggers();
if (mode == ProjectExplorer::Constants::RUNMODE || Analyzer::Constants::MODE_ANALYZE)
if (mode == ProjectExplorer::Constants::RUNMODE)
return freePortCount >= mountDirCount;
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment