forked from qt-creator/qt-creator
QmlProfiler: Remove RemoteLinux dependency
Change-Id: I3ff14691b4f9c80793a491b61444f8ceeb05a4fb Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
@@ -45,7 +45,7 @@ enum StartMode
|
||||
StartLocal = -1,
|
||||
StartRemote = -2,
|
||||
StartQml = -3,
|
||||
StartQmlAndroid = -4 // TODO: remove this enum and make it generic
|
||||
StartQmlRemote = -4 // TODO: remove this enum and make it generic
|
||||
};
|
||||
|
||||
namespace Constants {
|
||||
|
@@ -54,7 +54,7 @@ Id IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode)
|
||||
case StartRemote:
|
||||
return id.withSuffix(".Remote");
|
||||
case StartQml:
|
||||
case StartQmlAndroid:
|
||||
case StartQmlRemote:
|
||||
return id.withSuffix(".Qml");
|
||||
}
|
||||
return Id();
|
||||
|
@@ -63,7 +63,7 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
|
||||
|
||||
AnalyzerStartParameters params;
|
||||
params.toolId = tool->id();
|
||||
params.startMode = StartQmlAndroid;
|
||||
params.startMode = StartQmlRemote;
|
||||
Target *target = runConfig->target();
|
||||
params.displayName = AndroidManager::packageName(target);
|
||||
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
|
||||
|
@@ -11,7 +11,6 @@ SOURCES += \
|
||||
qmlprofilerengine.cpp \
|
||||
qmlprofilerattachdialog.cpp \
|
||||
localqmlprofilerrunner.cpp \
|
||||
remotelinuxqmlprofilerrunner.cpp \
|
||||
qmlprofilereventview.cpp \
|
||||
qmlprofilerdetailsrewriter.cpp \
|
||||
qmlprofilertraceview.cpp \
|
||||
@@ -32,7 +31,6 @@ HEADERS += \
|
||||
qmlprofilerattachdialog.h \
|
||||
abstractqmlprofilerrunner.h \
|
||||
localqmlprofilerrunner.h \
|
||||
remotelinuxqmlprofilerrunner.h \
|
||||
qmlprofilereventview.h \
|
||||
qmlprofilerdetailsrewriter.h \
|
||||
qmlprofilertraceview.h \
|
||||
|
@@ -55,8 +55,6 @@ QtcPlugin {
|
||||
"qmlprofilerviewmanager.h",
|
||||
"qv8profilerdatamodel.cpp",
|
||||
"qv8profilerdatamodel.h",
|
||||
"remotelinuxqmlprofilerrunner.cpp",
|
||||
"remotelinuxqmlprofilerrunner.h",
|
||||
"timelinerenderer.cpp",
|
||||
"timelinerenderer.h",
|
||||
"canvas/qdeclarativecanvas.cpp",
|
||||
|
@@ -7,5 +7,4 @@ QTC_PLUGIN_DEPENDS += \
|
||||
analyzerbase \
|
||||
qmlprojectmanager \
|
||||
qt4projectmanager \
|
||||
qmljstools \
|
||||
remotelinux
|
||||
qmljstools
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include "qmlprofilerengine.h"
|
||||
|
||||
#include "localqmlprofilerrunner.h"
|
||||
#include "remotelinuxqmlprofilerrunner.h"
|
||||
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -46,7 +45,6 @@
|
||||
#include <projectexplorer/localapplicationruncontrol.h>
|
||||
#include <projectexplorer/localapplicationrunconfiguration.h>
|
||||
#include <qmldebug/qmloutputparser.h>
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
@@ -91,37 +89,36 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
if (!runConfiguration) // attaching
|
||||
return 0;
|
||||
|
||||
if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig =
|
||||
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent);
|
||||
QmlProjectManager::QmlProjectRunConfiguration *rc1 =
|
||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
|
||||
LocalApplicationRunConfiguration *rc2 =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
||||
// Supports only local run configurations
|
||||
if (!rc1 && !rc2)
|
||||
return 0;
|
||||
|
||||
ProjectExplorer::EnvironmentAspect *environment
|
||||
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(environment, return 0);
|
||||
LocalQmlProfilerRunner::Configuration conf;
|
||||
if (rc1) {
|
||||
// This is a "plain" .qmlproject.
|
||||
conf.executable = rc1->observerPath();
|
||||
conf.executableArguments = rc1->viewerArguments();
|
||||
conf.workingDirectory = rc1->workingDirectory();
|
||||
conf.environment = environment->environment();
|
||||
} else {
|
||||
ProjectExplorer::EnvironmentAspect *environment
|
||||
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(environment, return 0);
|
||||
LocalQmlProfilerRunner::Configuration conf;
|
||||
if (QmlProjectManager::QmlProjectRunConfiguration *rc1 =
|
||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) {
|
||||
// This is a "plain" .qmlproject.
|
||||
conf.executable = rc1->observerPath();
|
||||
conf.executableArguments = rc1->viewerArguments();
|
||||
conf.workingDirectory = rc1->workingDirectory();
|
||||
conf.environment = environment->environment();
|
||||
} else if (LocalApplicationRunConfiguration *rc2 =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
// FIXME: Check.
|
||||
conf.executable = rc2->executable();
|
||||
conf.executableArguments = rc2->commandLineArguments();
|
||||
conf.workingDirectory = rc2->workingDirectory();
|
||||
conf.environment = environment->environment();
|
||||
} else {
|
||||
QTC_CHECK(false);
|
||||
}
|
||||
const ProjectExplorer::IDevice::ConstPtr device =
|
||||
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
|
||||
conf.port = sp.analyzerPort;
|
||||
runner = new LocalQmlProfilerRunner(conf, parent);
|
||||
// FIXME: Check.
|
||||
conf.executable = rc2->executable();
|
||||
conf.executableArguments = rc2->commandLineArguments();
|
||||
conf.workingDirectory = rc2->workingDirectory();
|
||||
conf.environment = environment->environment();
|
||||
}
|
||||
const ProjectExplorer::IDevice::ConstPtr device =
|
||||
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
|
||||
conf.port = sp.analyzerPort;
|
||||
runner = new LocalQmlProfilerRunner(conf, parent);
|
||||
return runner;
|
||||
}
|
||||
|
||||
@@ -197,7 +194,7 @@ bool QmlProfilerEngine::start()
|
||||
this, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
|
||||
d->m_runner->start();
|
||||
d->m_noDebugOutputTimer.start();
|
||||
} else if (d->sp.startMode == StartQmlAndroid) {
|
||||
} else if (d->sp.startMode == StartQmlRemote) {
|
||||
d->m_noDebugOutputTimer.start();
|
||||
} else {
|
||||
emit processRunning(startParameters().analyzerPort);
|
||||
|
@@ -57,9 +57,6 @@
|
||||
#include <projectexplorer/localapplicationrunconfiguration.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
#include <remotelinux/linuxdevice.h>
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -97,7 +94,6 @@ using namespace QmlProfiler::Constants;
|
||||
using namespace QmlDebug;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QmlProjectManager;
|
||||
using namespace RemoteLinux;
|
||||
|
||||
class QmlProfilerTool::QmlProfilerToolPrivate
|
||||
{
|
||||
@@ -284,7 +280,6 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
|
||||
bool QmlProfilerTool::canRun(RunConfiguration *runConfiguration, RunMode mode) const
|
||||
{
|
||||
if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)
|
||||
|| qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)
|
||||
|| qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration))
|
||||
return mode == runMode();
|
||||
return false;
|
||||
@@ -328,16 +323,6 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration
|
||||
sp.debuggee = rc2->executable();
|
||||
sp.debuggeeArgs = rc2->commandLineArguments();
|
||||
sp.displayName = rc2->displayName();
|
||||
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 =
|
||||
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp.debuggee = rc3->remoteExecutableFilePath();
|
||||
sp.debuggeeArgs = rc3->arguments();
|
||||
sp.connParams = ProjectExplorer::DeviceKitInformation::device(rc3->target()->kit())->sshParameters();
|
||||
sp.analyzerCmdPrefix = rc3->commandPrefix();
|
||||
sp.displayName = rc3->displayName();
|
||||
sp.sysroot = sysroot(rc3);
|
||||
sp.analyzerHost = sp.connParams.host;
|
||||
sp.analyzerPort = sp.connParams.port;
|
||||
} else {
|
||||
// What could that be?
|
||||
QTC_ASSERT(false, return sp);
|
||||
|
205
src/plugins/remotelinux/iremotelinuxrunsupport.cpp
Normal file
205
src/plugins/remotelinux/iremotelinuxrunsupport.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "iremotelinuxrunsupport.h"
|
||||
#include "remotelinuxrunconfiguration.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
|
||||
#include <utils/portlist.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace RemoteLinux {
|
||||
namespace Internal {
|
||||
|
||||
class IRemoteLinuxRunSupportPrivate
|
||||
{
|
||||
public:
|
||||
IRemoteLinuxRunSupportPrivate(const RemoteLinuxRunConfiguration *runConfig)
|
||||
: state(IRemoteLinuxRunSupport::Inactive),
|
||||
device(DeviceKitInformation::device(runConfig->target()->kit())),
|
||||
remoteFilePath(runConfig->remoteExecutableFilePath()),
|
||||
arguments(runConfig->arguments()),
|
||||
commandPrefix(runConfig->commandPrefix())
|
||||
{
|
||||
}
|
||||
|
||||
IRemoteLinuxRunSupport::State state;
|
||||
DeviceApplicationRunner appRunner;
|
||||
DeviceUsedPortsGatherer portsGatherer;
|
||||
const ProjectExplorer::IDevice::ConstPtr device;
|
||||
Utils::PortList portList;
|
||||
const QString remoteFilePath;
|
||||
const QString arguments;
|
||||
const QString commandPrefix;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
IRemoteLinuxRunSupport::IRemoteLinuxRunSupport(RemoteLinuxRunConfiguration *runConfig, QObject *parent)
|
||||
: QObject(parent),
|
||||
d(new IRemoteLinuxRunSupportPrivate(runConfig))
|
||||
{
|
||||
}
|
||||
|
||||
IRemoteLinuxRunSupport::~IRemoteLinuxRunSupport()
|
||||
{
|
||||
setFinished();
|
||||
delete d;
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::setApplicationRunnerPreRunAction(DeviceApplicationHelperAction *action)
|
||||
{
|
||||
d->appRunner.setPreRunAction(action);
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::setApplicationRunnerPostRunAction(DeviceApplicationHelperAction *action)
|
||||
{
|
||||
d->appRunner.setPostRunAction(action);
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::setState(IRemoteLinuxRunSupport::State state)
|
||||
{
|
||||
d->state = state;
|
||||
}
|
||||
|
||||
IRemoteLinuxRunSupport::State IRemoteLinuxRunSupport::state() const
|
||||
{
|
||||
return d->state;
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleRemoteSetupRequested()
|
||||
{
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
d->state = GatheringPorts;
|
||||
connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGathererError(QString)));
|
||||
connect(&d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady()));
|
||||
d->portsGatherer.start(d->device);
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handlePortsGathererError(const QString &message)
|
||||
{
|
||||
QTC_ASSERT(d->state == GatheringPorts, return);
|
||||
handleAdapterSetupFailed(message);
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handlePortListReady()
|
||||
{
|
||||
QTC_ASSERT(d->state == GatheringPorts, return);
|
||||
|
||||
d->portList = d->device->freePorts();
|
||||
startExecution();
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleAppRunnerError(const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleRemoteOutput(const QByteArray &)
|
||||
{
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleRemoteErrorOutput(const QByteArray &)
|
||||
{
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleAppRunnerFinished(bool)
|
||||
{
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleProgressReport(const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleAdapterSetupFailed(const QString &)
|
||||
{
|
||||
setFinished();
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::handleAdapterSetupDone()
|
||||
{
|
||||
d->state = Running;
|
||||
}
|
||||
|
||||
void IRemoteLinuxRunSupport::setFinished()
|
||||
{
|
||||
if (d->state == Inactive)
|
||||
return;
|
||||
d->portsGatherer.disconnect(this);
|
||||
d->appRunner.disconnect(this);
|
||||
if (d->state == Running) {
|
||||
const QString stopCommand
|
||||
= d->device->processSupport()->killProcessByNameCommandLine(d->remoteFilePath);
|
||||
d->appRunner.stop(stopCommand.toUtf8());
|
||||
}
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
bool IRemoteLinuxRunSupport::setPort(int &port)
|
||||
{
|
||||
port = d->portsGatherer.getNextFreePort(&d->portList);
|
||||
if (port == -1) {
|
||||
handleAdapterSetupFailed(tr("Not enough free ports on device for debugging."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString IRemoteLinuxRunSupport::arguments() const
|
||||
{
|
||||
return d->arguments;
|
||||
}
|
||||
|
||||
QString IRemoteLinuxRunSupport::commandPrefix() const
|
||||
{
|
||||
return d->commandPrefix;
|
||||
}
|
||||
|
||||
QString IRemoteLinuxRunSupport::remoteFilePath() const
|
||||
{
|
||||
return d->remoteFilePath;
|
||||
}
|
||||
|
||||
const IDevice::ConstPtr IRemoteLinuxRunSupport::device() const
|
||||
{
|
||||
return d->device;
|
||||
}
|
||||
|
||||
DeviceApplicationRunner *IRemoteLinuxRunSupport::appRunner() const
|
||||
{
|
||||
return &d->appRunner;
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
106
src/plugins/remotelinux/iremotelinuxrunsupport.h
Normal file
106
src/plugins/remotelinux/iremotelinuxrunsupport.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 IREMOTELINUXRUNSUPPORT_H
|
||||
#define IREMOTELINUXRUNSUPPORT_H
|
||||
|
||||
#include "remotelinux_export.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeviceApplicationHelperAction;
|
||||
class DeviceApplicationRunner;
|
||||
}
|
||||
|
||||
namespace RemoteLinux {
|
||||
|
||||
class RemoteLinuxRunConfiguration;
|
||||
|
||||
namespace Internal { class IRemoteLinuxRunSupportPrivate; }
|
||||
|
||||
class REMOTELINUX_EXPORT IRemoteLinuxRunSupport : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
enum State
|
||||
{
|
||||
Inactive,
|
||||
GatheringPorts,
|
||||
StartingRunner,
|
||||
Running
|
||||
};
|
||||
public:
|
||||
IRemoteLinuxRunSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||
QObject *parent = 0);
|
||||
~IRemoteLinuxRunSupport();
|
||||
|
||||
void setApplicationRunnerPreRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
|
||||
void setApplicationRunnerPostRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
|
||||
|
||||
protected:
|
||||
void setState(State state);
|
||||
State state() const;
|
||||
ProjectExplorer::DeviceApplicationRunner *appRunner() const;
|
||||
|
||||
virtual void startExecution() = 0;
|
||||
|
||||
virtual void handleAdapterSetupFailed(const QString &error);
|
||||
virtual void handleAdapterSetupDone();
|
||||
|
||||
void setFinished();
|
||||
bool setPort(int &port);
|
||||
|
||||
QString arguments() const;
|
||||
QString commandPrefix() const;
|
||||
QString remoteFilePath() const;
|
||||
const ProjectExplorer::IDevice::ConstPtr device() const;
|
||||
|
||||
protected slots:
|
||||
virtual void handleRemoteSetupRequested();
|
||||
virtual void handleAppRunnerError(const QString &error);
|
||||
virtual void handleRemoteOutput(const QByteArray &output);
|
||||
virtual void handleRemoteErrorOutput(const QByteArray &output);
|
||||
virtual void handleAppRunnerFinished(bool success);
|
||||
virtual void handleProgressReport(const QString &progressOutput);
|
||||
|
||||
private slots:
|
||||
void handlePortsGathererError(const QString &message);
|
||||
void handlePortListReady();
|
||||
|
||||
private:
|
||||
friend class Internal::IRemoteLinuxRunSupportPrivate;
|
||||
Internal::IRemoteLinuxRunSupportPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
#endif // IREMOTELINUXRUNSUPPORT_H
|
@@ -46,7 +46,9 @@ HEADERS += \
|
||||
genericlinuxdeviceconfigurationwidget.h \
|
||||
remotelinuxcheckforfreediskspaceservice.h \
|
||||
remotelinuxcheckforfreediskspacestep.h \
|
||||
remotelinuxdeploymentdatamodel.h
|
||||
remotelinuxdeploymentdatamodel.h \
|
||||
iremotelinuxrunsupport.h \
|
||||
remotelinuxanalyzesupport.h
|
||||
|
||||
SOURCES += \
|
||||
embeddedlinuxqtversion.cpp \
|
||||
@@ -90,7 +92,9 @@ SOURCES += \
|
||||
genericlinuxdeviceconfigurationwidget.cpp \
|
||||
remotelinuxcheckforfreediskspaceservice.cpp \
|
||||
remotelinuxcheckforfreediskspacestep.cpp \
|
||||
remotelinuxdeploymentdatamodel.cpp
|
||||
remotelinuxdeploymentdatamodel.cpp \
|
||||
iremotelinuxrunsupport.cpp \
|
||||
remotelinuxanalyzesupport.cpp
|
||||
|
||||
FORMS += \
|
||||
genericlinuxdeviceconfigurationwizardsetuppage.ui \
|
||||
|
@@ -3,4 +3,5 @@ QTC_PLUGIN_DEPENDS += \
|
||||
coreplugin \
|
||||
debugger \
|
||||
projectexplorer \
|
||||
qtsupport
|
||||
qtsupport \
|
||||
analyzerbase
|
||||
|
207
src/plugins/remotelinux/remotelinuxanalyzesupport.cpp
Normal file
207
src/plugins/remotelinux/remotelinuxanalyzesupport.cpp
Normal file
@@ -0,0 +1,207 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "remotelinuxanalyzesupport.h"
|
||||
|
||||
#include "remotelinuxrunconfiguration.h"
|
||||
|
||||
#include <analyzerbase/ianalyzerengine.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
using namespace QSsh;
|
||||
using namespace Analyzer;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace RemoteLinux {
|
||||
namespace Internal {
|
||||
|
||||
class RemoteLinuxAnalyzeSupportPrivate
|
||||
{
|
||||
public:
|
||||
RemoteLinuxAnalyzeSupportPrivate(IAnalyzerEngine *engine, RunMode runMode)
|
||||
: engine(engine),
|
||||
qmlProfiling(runMode == QmlProfilerRunMode),
|
||||
qmlPort(-1)
|
||||
{
|
||||
}
|
||||
|
||||
const QPointer<IAnalyzerEngine> engine;
|
||||
bool qmlProfiling;
|
||||
int qmlPort;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RemoteLinuxRunConfiguration *runConfig,
|
||||
RunMode runMode)
|
||||
{
|
||||
AnalyzerStartParameters params;
|
||||
if (runMode == QmlProfilerRunMode)
|
||||
params.startMode = StartQmlRemote;
|
||||
params.debuggee = runConfig->remoteExecutableFilePath();
|
||||
params.debuggeeArgs = runConfig->arguments();
|
||||
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
|
||||
params.analyzerCmdPrefix = runConfig->commandPrefix();
|
||||
params.displayName = runConfig->displayName();
|
||||
params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
|
||||
params.analyzerHost = params.connParams.host;
|
||||
params.analyzerPort = params.connParams.port;
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||
IAnalyzerEngine *engine, RunMode runMode)
|
||||
: IRemoteLinuxRunSupport(runConfig, engine),
|
||||
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
|
||||
{
|
||||
connect(d->engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
|
||||
SLOT(handleRemoteSetupRequested()));
|
||||
connect(d->engine, SIGNAL(finished()), SLOT(handleProfilingFinished()));
|
||||
}
|
||||
|
||||
RemoteLinuxAnalyzeSupport::~RemoteLinuxAnalyzeSupport()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format)
|
||||
{
|
||||
if (state() != Inactive && d->engine)
|
||||
d->engine->logApplicationMessage(msg, format);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested()
|
||||
{
|
||||
QTC_ASSERT(state() == Inactive, return);
|
||||
|
||||
showMessage(tr("Checking available ports...\n"), Utils::NormalMessageFormat);
|
||||
IRemoteLinuxRunSupport::handleRemoteSetupRequested();
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::startExecution()
|
||||
{
|
||||
QTC_ASSERT(state() == GatheringPorts, return);
|
||||
|
||||
if (d->qmlProfiling && !setPort(d->qmlPort))
|
||||
return;
|
||||
|
||||
setState(StartingRunner);
|
||||
|
||||
DeviceApplicationRunner *runner = appRunner();
|
||||
connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteErrorOutput(QByteArray)));
|
||||
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
||||
if (d->qmlProfiling)
|
||||
connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted()));
|
||||
QString args = arguments();
|
||||
if (d->qmlProfiling)
|
||||
args += QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort);
|
||||
const QString remoteCommandLine = d->qmlProfiling
|
||||
? QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args)
|
||||
: QString();
|
||||
connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool)));
|
||||
connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString)));
|
||||
connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString)));
|
||||
runner->start(device(), remoteCommandLine.toUtf8());
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error)
|
||||
{
|
||||
if (state() == Running)
|
||||
showMessage(error, Utils::ErrorMessageFormat);
|
||||
else if (state() != Inactive)
|
||||
handleAdapterSetupFailed(error);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleAppRunnerFinished(bool success)
|
||||
{
|
||||
if (!success)
|
||||
showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleProfilingFinished()
|
||||
{
|
||||
setFinished();
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
|
||||
{
|
||||
QTC_ASSERT(state() == Inactive || state() == Running, return);
|
||||
|
||||
showMessage(QString::fromUtf8(output), Utils::StdOutFormat);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleRemoteErrorOutput(const QByteArray &output)
|
||||
{
|
||||
QTC_ASSERT(state() != GatheringPorts, return);
|
||||
|
||||
if (!d->engine)
|
||||
return;
|
||||
|
||||
showMessage(QString::fromUtf8(output), Utils::StdErrFormat);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleProgressReport(const QString &progressOutput)
|
||||
{
|
||||
showMessage(progressOutput + QLatin1Char('\n'), Utils::NormalMessageFormat);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleAdapterSetupFailed(const QString &error)
|
||||
{
|
||||
IRemoteLinuxRunSupport::handleAdapterSetupFailed(error);
|
||||
showMessage(tr("Initial setup failed: %1").arg(error), Utils::NormalMessageFormat);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleAdapterSetupDone()
|
||||
{
|
||||
IRemoteLinuxRunSupport::handleAdapterSetupDone();
|
||||
d->engine->notifyRemoteSetupDone(d->qmlPort);
|
||||
}
|
||||
|
||||
void RemoteLinuxAnalyzeSupport::handleRemoteProcessStarted()
|
||||
{
|
||||
QTC_ASSERT(d->qmlProfiling, return);
|
||||
QTC_ASSERT(state() == StartingRunner, return);
|
||||
|
||||
handleAdapterSetupDone();
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
83
src/plugins/remotelinux/remotelinuxanalyzesupport.h
Normal file
83
src/plugins/remotelinux/remotelinuxanalyzesupport.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 REMOTELINUXANALYZESUPPORT_H
|
||||
#define REMOTELINUXANALYZESUPPORT_H
|
||||
|
||||
#include "iremotelinuxrunsupport.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/outputformat.h>
|
||||
|
||||
namespace Analyzer {
|
||||
class AnalyzerStartParameters;
|
||||
class IAnalyzerEngine;
|
||||
}
|
||||
|
||||
namespace RemoteLinux {
|
||||
class RemoteLinuxRunConfiguration;
|
||||
|
||||
namespace Internal { class RemoteLinuxAnalyzeSupportPrivate; }
|
||||
|
||||
class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public IRemoteLinuxRunSupport
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static Analyzer::AnalyzerStartParameters startParameters(const RemoteLinuxRunConfiguration *runConfig,
|
||||
ProjectExplorer::RunMode runMode);
|
||||
|
||||
RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||
Analyzer::IAnalyzerEngine *engine, ProjectExplorer::RunMode runMode);
|
||||
~RemoteLinuxAnalyzeSupport();
|
||||
|
||||
protected:
|
||||
void startExecution();
|
||||
void handleAdapterSetupFailed(const QString &error);
|
||||
void handleAdapterSetupDone();
|
||||
|
||||
private slots:
|
||||
void handleRemoteSetupRequested();
|
||||
void handleAppRunnerError(const QString &error);
|
||||
void handleRemoteOutput(const QByteArray &output);
|
||||
void handleRemoteErrorOutput(const QByteArray &output);
|
||||
void handleAppRunnerFinished(bool success);
|
||||
void handleProgressReport(const QString &progressOutput);
|
||||
|
||||
void handleRemoteProcessStarted();
|
||||
void handleProfilingFinished();
|
||||
|
||||
private:
|
||||
void showMessage(const QString &, Utils::OutputFormat);
|
||||
|
||||
Internal::RemoteLinuxAnalyzeSupportPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
#endif // REMOTELINUXANALYZESUPPORT_H
|
@@ -36,12 +36,11 @@
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <utils/portlist.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QPointer>
|
||||
@@ -52,9 +51,6 @@ using namespace ProjectExplorer;
|
||||
|
||||
namespace RemoteLinux {
|
||||
namespace Internal {
|
||||
namespace {
|
||||
enum State { Inactive, GatheringPorts, StartingRunner, Debugging };
|
||||
} // anonymous namespace
|
||||
|
||||
class LinuxDeviceDebugSupportPrivate
|
||||
{
|
||||
@@ -64,12 +60,7 @@ public:
|
||||
: engine(engine),
|
||||
qmlDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger()),
|
||||
cppDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger()),
|
||||
state(Inactive),
|
||||
gdbServerPort(-1), qmlPort(-1),
|
||||
device(DeviceKitInformation::device(runConfig->target()->kit())),
|
||||
remoteFilePath(runConfig->remoteExecutableFilePath()),
|
||||
arguments(runConfig->arguments()),
|
||||
commandPrefix(runConfig->commandPrefix())
|
||||
gdbServerPort(-1), qmlPort(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -77,16 +68,8 @@ public:
|
||||
bool qmlDebugging;
|
||||
bool cppDebugging;
|
||||
QByteArray gdbserverOutput;
|
||||
State state;
|
||||
int gdbServerPort;
|
||||
int qmlPort;
|
||||
DeviceApplicationRunner appRunner;
|
||||
DeviceUsedPortsGatherer portsGatherer;
|
||||
const ProjectExplorer::IDevice::ConstPtr device;
|
||||
Utils::PortList portList;
|
||||
const QString remoteFilePath;
|
||||
const QString arguments;
|
||||
const QString commandPrefix;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
@@ -135,9 +118,9 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const RemoteLin
|
||||
return params;
|
||||
}
|
||||
|
||||
LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunConfiguration *runConfig,
|
||||
LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||
DebuggerEngine *engine)
|
||||
: QObject(engine),
|
||||
: IRemoteLinuxRunSupport(runConfig, engine),
|
||||
d(new LinuxDeviceDebugSupportPrivate(static_cast<RemoteLinuxRunConfiguration *>(runConfig), engine))
|
||||
{
|
||||
connect(d->engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleRemoteSetupRequested()));
|
||||
@@ -145,96 +128,70 @@ LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunConfiguration *runConfig,
|
||||
|
||||
LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport()
|
||||
{
|
||||
setFinished();
|
||||
delete d;
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::setApplicationRunnerPreRunAction(DeviceApplicationHelperAction *action)
|
||||
{
|
||||
d->appRunner.setPreRunAction(action);
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::setApplicationRunnerPostRunAction(DeviceApplicationHelperAction *action)
|
||||
{
|
||||
d->appRunner.setPostRunAction(action);
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
|
||||
{
|
||||
if (d->state != Inactive && d->engine)
|
||||
if (state() != Inactive && d->engine)
|
||||
d->engine->showMessage(msg, channel);
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handleRemoteSetupRequested()
|
||||
{
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
QTC_ASSERT(state() == Inactive, return);
|
||||
|
||||
d->state = GatheringPorts;
|
||||
showMessage(tr("Checking available ports...\n"), LogStatus);
|
||||
connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGathererError(QString)));
|
||||
connect(&d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady()));
|
||||
d->portsGatherer.start(d->device);
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handlePortsGathererError(const QString &message)
|
||||
{
|
||||
QTC_ASSERT(d->state == GatheringPorts, return);
|
||||
handleAdapterSetupFailed(message);
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handlePortListReady()
|
||||
{
|
||||
QTC_ASSERT(d->state == GatheringPorts, return);
|
||||
|
||||
d->portList = d->device->freePorts();
|
||||
startExecution();
|
||||
IRemoteLinuxRunSupport::handleRemoteSetupRequested();
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::startExecution()
|
||||
{
|
||||
QTC_ASSERT(d->state == GatheringPorts, return);
|
||||
QTC_ASSERT(state() == GatheringPorts, return);
|
||||
|
||||
if (d->cppDebugging && !setPort(d->gdbServerPort))
|
||||
return;
|
||||
if (d->qmlDebugging && !setPort(d->qmlPort))
|
||||
return;
|
||||
|
||||
d->state = StartingRunner;
|
||||
setState(StartingRunner);
|
||||
d->gdbserverOutput.clear();
|
||||
|
||||
connect(&d->appRunner, SIGNAL(remoteStderr(QByteArray)),
|
||||
SLOT(handleRemoteErrorOutput(QByteArray)));
|
||||
connect(&d->appRunner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
||||
DeviceApplicationRunner *runner = appRunner();
|
||||
connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteErrorOutput(QByteArray)));
|
||||
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
||||
if (d->qmlDebugging && !d->cppDebugging)
|
||||
connect(&d->appRunner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted()));
|
||||
QString args = d->arguments;
|
||||
connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted()));
|
||||
QString args = arguments();
|
||||
if (d->qmlDebugging)
|
||||
args += QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort);
|
||||
const QString remoteCommandLine = (d->qmlDebugging && !d->cppDebugging)
|
||||
? QString::fromLatin1("%1 %2 %3").arg(d->commandPrefix).arg(d->remoteFilePath).arg(args)
|
||||
: QString::fromLatin1("%1 gdbserver :%2 %3 %4").arg(d->commandPrefix)
|
||||
.arg(d->gdbServerPort).arg(d->remoteFilePath).arg(args);
|
||||
connect(&d->appRunner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool)));
|
||||
d->appRunner.start(d->device, remoteCommandLine.toUtf8());
|
||||
? QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args)
|
||||
: QString::fromLatin1("%1 gdbserver :%2 %3 %4").arg(commandPrefix())
|
||||
.arg(d->gdbServerPort).arg(remoteFilePath()).arg(args);
|
||||
connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool)));
|
||||
connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString)));
|
||||
connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString)));
|
||||
runner->start(device(), remoteCommandLine.toUtf8());
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
|
||||
{
|
||||
if (d->state == Debugging) {
|
||||
if (state() == Running) {
|
||||
showMessage(error, AppError);
|
||||
if (d->engine)
|
||||
d->engine->notifyInferiorIll();
|
||||
} else if (d->state != Inactive) {
|
||||
} else if (state() != Inactive) {
|
||||
handleAdapterSetupFailed(error);
|
||||
}
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success)
|
||||
{
|
||||
if (!d->engine || d->state == Inactive)
|
||||
if (!d->engine || state() == Inactive)
|
||||
return;
|
||||
|
||||
if (d->state == Debugging) {
|
||||
if (state() == Running) {
|
||||
// The QML engine does not realize on its own that the application has finished.
|
||||
if (d->qmlDebugging && !d->cppDebugging)
|
||||
d->engine->quitDebugger();
|
||||
@@ -253,20 +210,20 @@ void LinuxDeviceDebugSupport::handleDebuggingFinished()
|
||||
|
||||
void LinuxDeviceDebugSupport::handleRemoteOutput(const QByteArray &output)
|
||||
{
|
||||
QTC_ASSERT(d->state == Inactive || d->state == Debugging, return);
|
||||
QTC_ASSERT(state() == Inactive || state() == Running, return);
|
||||
|
||||
showMessage(QString::fromUtf8(output), AppOutput);
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
|
||||
{
|
||||
QTC_ASSERT(d->state != GatheringPorts, return);
|
||||
QTC_ASSERT(state() != GatheringPorts, return);
|
||||
|
||||
if (!d->engine)
|
||||
return;
|
||||
|
||||
showMessage(QString::fromUtf8(output), AppError);
|
||||
if (d->state == StartingRunner && d->cppDebugging) {
|
||||
if (state() == StartingRunner && d->cppDebugging) {
|
||||
d->gdbserverOutput += output;
|
||||
if (d->gdbserverOutput.contains("Listening on port")) {
|
||||
handleAdapterSetupDone();
|
||||
@@ -282,46 +239,22 @@ void LinuxDeviceDebugSupport::handleProgressReport(const QString &progressOutput
|
||||
|
||||
void LinuxDeviceDebugSupport::handleAdapterSetupFailed(const QString &error)
|
||||
{
|
||||
setFinished();
|
||||
IRemoteLinuxRunSupport::handleAdapterSetupFailed(error);
|
||||
d->engine->notifyEngineRemoteSetupFailed(tr("Initial setup failed: %1").arg(error));
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handleAdapterSetupDone()
|
||||
{
|
||||
d->state = Debugging;
|
||||
IRemoteLinuxRunSupport::handleAdapterSetupDone();
|
||||
d->engine->notifyEngineRemoteSetupDone(d->gdbServerPort, d->qmlPort);
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handleRemoteProcessStarted()
|
||||
{
|
||||
QTC_ASSERT(d->qmlDebugging && !d->cppDebugging, return);
|
||||
QTC_ASSERT(d->state == StartingRunner, return);
|
||||
QTC_ASSERT(state() == StartingRunner, return);
|
||||
|
||||
handleAdapterSetupDone();
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::setFinished()
|
||||
{
|
||||
if (d->state == Inactive)
|
||||
return;
|
||||
d->portsGatherer.disconnect(this);
|
||||
d->appRunner.disconnect(this);
|
||||
if (d->state == StartingRunner) {
|
||||
const QString stopCommand
|
||||
= d->device->processSupport()->killProcessByNameCommandLine(d->remoteFilePath);
|
||||
d->appRunner.stop(stopCommand.toUtf8());
|
||||
}
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
bool LinuxDeviceDebugSupport::setPort(int &port)
|
||||
{
|
||||
port = d->portsGatherer.getNextFreePort(&d->portList);
|
||||
if (port == -1) {
|
||||
handleAdapterSetupFailed(tr("Not enough free ports on device for debugging."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
@@ -30,56 +30,45 @@
|
||||
#ifndef REMOTELINUXDEBUGSUPPORT_H
|
||||
#define REMOTELINUXDEBUGSUPPORT_H
|
||||
|
||||
#include "remotelinux_export.h"
|
||||
|
||||
#include <QObject>
|
||||
#include "iremotelinuxrunsupport.h"
|
||||
|
||||
namespace Debugger {
|
||||
class DebuggerEngine;
|
||||
class DebuggerStartParameters;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeviceApplicationHelperAction;
|
||||
class RunConfiguration;
|
||||
}
|
||||
|
||||
namespace RemoteLinux {
|
||||
class RemoteLinuxRunConfiguration;
|
||||
|
||||
namespace Internal { class LinuxDeviceDebugSupportPrivate; }
|
||||
|
||||
class REMOTELINUX_EXPORT LinuxDeviceDebugSupport : public QObject
|
||||
class REMOTELINUX_EXPORT LinuxDeviceDebugSupport : public IRemoteLinuxRunSupport
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static Debugger::DebuggerStartParameters startParameters(const RemoteLinuxRunConfiguration *runConfig);
|
||||
|
||||
LinuxDeviceDebugSupport(ProjectExplorer::RunConfiguration *runConfig,
|
||||
LinuxDeviceDebugSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||
Debugger::DebuggerEngine *engine);
|
||||
~LinuxDeviceDebugSupport();
|
||||
|
||||
void setApplicationRunnerPreRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
|
||||
void setApplicationRunnerPostRunAction(ProjectExplorer::DeviceApplicationHelperAction *action);
|
||||
protected:
|
||||
void startExecution();
|
||||
void handleAdapterSetupFailed(const QString &error);
|
||||
void handleAdapterSetupDone();
|
||||
|
||||
private slots:
|
||||
void handleRemoteSetupRequested();
|
||||
void handleAppRunnerError(const QString &error);
|
||||
void startExecution();
|
||||
void handleDebuggingFinished();
|
||||
void handleRemoteOutput(const QByteArray &output);
|
||||
void handleRemoteErrorOutput(const QByteArray &output);
|
||||
void handleProgressReport(const QString &progressOutput);
|
||||
void handleRemoteProcessStarted();
|
||||
void handleAppRunnerFinished(bool success);
|
||||
void handlePortsGathererError(const QString &message);
|
||||
void handlePortListReady();
|
||||
void handleProgressReport(const QString &progressOutput);
|
||||
|
||||
void handleRemoteProcessStarted();
|
||||
void handleDebuggingFinished();
|
||||
|
||||
private:
|
||||
void handleAdapterSetupFailed(const QString &error);
|
||||
void handleAdapterSetupDone();
|
||||
void setFinished();
|
||||
bool setPort(int &port);
|
||||
void showMessage(const QString &msg, int channel);
|
||||
|
||||
Internal::LinuxDeviceDebugSupportPrivate * const d;
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "remotelinuxruncontrolfactory.h"
|
||||
|
||||
#include "remotelinuxanalyzesupport.h"
|
||||
#include "remotelinuxdebugsupport.h"
|
||||
#include "remotelinuxrunconfiguration.h"
|
||||
#include "remotelinuxruncontrol.h"
|
||||
@@ -36,11 +37,15 @@
|
||||
#include <debugger/debuggerplugin.h>
|
||||
#include <debugger/debuggerrunner.h>
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
#include <analyzerbase/analyzerstartparameters.h>
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzerruncontrol.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/portlist.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Analyzer;
|
||||
using namespace Debugger;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
@@ -58,8 +63,10 @@ RemoteLinuxRunControlFactory::~RemoteLinuxRunControlFactory()
|
||||
|
||||
bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
|
||||
{
|
||||
if (mode != NormalRunMode && mode != DebugRunMode && mode != DebugRunModeWithBreakOnMain)
|
||||
if (mode != NormalRunMode && mode != DebugRunMode && mode != DebugRunModeWithBreakOnMain
|
||||
&& mode != QmlProfilerRunMode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const QByteArray idStr = runConfiguration->id().name();
|
||||
return runConfiguration->isEnabled() && idStr.startsWith(RemoteLinuxRunConfiguration::IdPrefix);
|
||||
@@ -98,8 +105,21 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
|
||||
connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished()));
|
||||
return runControl;
|
||||
}
|
||||
case QmlProfilerRunMode: {
|
||||
IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
|
||||
if (!tool) {
|
||||
if (errorMessage)
|
||||
*errorMessage = tr("No analyzer tool selected.");
|
||||
return 0;
|
||||
}
|
||||
AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(rc, mode);
|
||||
AnalyzerRunControl * const runControl = new AnalyzerRunControl(tool, params, runConfig);
|
||||
RemoteLinuxAnalyzeSupport * const analyzeSupport =
|
||||
new RemoteLinuxAnalyzeSupport(rc, runControl->engine(), mode);
|
||||
connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
|
||||
return runControl;
|
||||
}
|
||||
case NoRunMode:
|
||||
case QmlProfilerRunMode:
|
||||
case CallgrindRunMode:
|
||||
case MemcheckRunMode:
|
||||
QTC_ASSERT(false, return 0);
|
||||
|
Reference in New Issue
Block a user