RemoteLinuxRunSupport: Fix broken code

Fix broken debug and profiling support on remote linux.

Change-Id: Ic4173a47b8fd450a92407a66fa338c18f7062736
Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
Aurindam Jana
2013-07-19 10:15:47 +02:00
parent d53609d27b
commit 2a1ca98958
4 changed files with 26 additions and 29 deletions

View File

@@ -123,29 +123,10 @@ void AbstractRemoteLinuxRunSupport::handlePortListReady()
startExecution(); startExecution();
} }
void AbstractRemoteLinuxRunSupport::handleAppRunnerError(const QString &)
{
}
void AbstractRemoteLinuxRunSupport::handleRemoteOutput(const QByteArray &)
{
}
void AbstractRemoteLinuxRunSupport::handleRemoteErrorOutput(const QByteArray &)
{
}
void AbstractRemoteLinuxRunSupport::handleAppRunnerFinished(bool)
{
}
void AbstractRemoteLinuxRunSupport::handleProgressReport(const QString &)
{
}
void AbstractRemoteLinuxRunSupport::handleAdapterSetupFailed(const QString &) void AbstractRemoteLinuxRunSupport::handleAdapterSetupFailed(const QString &)
{ {
setFinished(); setFinished();
reset();
} }
void AbstractRemoteLinuxRunSupport::handleAdapterSetupDone() void AbstractRemoteLinuxRunSupport::handleAdapterSetupDone()
@@ -157,8 +138,6 @@ void AbstractRemoteLinuxRunSupport::setFinished()
{ {
if (d->state == Inactive) if (d->state == Inactive)
return; return;
d->portsGatherer.disconnect(this);
d->appRunner.disconnect(this);
if (d->state == Running) { if (d->state == Running) {
const QString stopCommand const QString stopCommand
= d->device->processSupport()->killProcessByNameCommandLine(d->remoteFilePath); = d->device->processSupport()->killProcessByNameCommandLine(d->remoteFilePath);
@@ -197,6 +176,13 @@ const IDevice::ConstPtr AbstractRemoteLinuxRunSupport::device() const
return d->device; return d->device;
} }
void AbstractRemoteLinuxRunSupport::reset()
{
d->portsGatherer.disconnect(this);
d->appRunner.disconnect(this);
d->state = Inactive;
}
DeviceApplicationRunner *AbstractRemoteLinuxRunSupport::appRunner() const DeviceApplicationRunner *AbstractRemoteLinuxRunSupport::appRunner() const
{ {
return &d->appRunner; return &d->appRunner;

View File

@@ -84,13 +84,15 @@ protected:
QString remoteFilePath() const; QString remoteFilePath() const;
const ProjectExplorer::IDevice::ConstPtr device() const; const ProjectExplorer::IDevice::ConstPtr device() const;
void reset();
protected slots: protected slots:
virtual void handleRemoteSetupRequested(); virtual void handleRemoteSetupRequested();
virtual void handleAppRunnerError(const QString &error); virtual void handleAppRunnerError(const QString &error) = 0;
virtual void handleRemoteOutput(const QByteArray &output); virtual void handleRemoteOutput(const QByteArray &output) = 0;
virtual void handleRemoteErrorOutput(const QByteArray &output); virtual void handleRemoteErrorOutput(const QByteArray &output) = 0;
virtual void handleAppRunnerFinished(bool success); virtual void handleAppRunnerFinished(bool success) = 0;
virtual void handleProgressReport(const QString &progressOutput); virtual void handleProgressReport(const QString &progressOutput) = 0;
private slots: private slots:
void handlePortsGathererError(const QString &message); void handlePortsGathererError(const QString &message);

View File

@@ -95,7 +95,6 @@ RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration
{ {
connect(d->engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), connect(d->engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
SLOT(handleRemoteSetupRequested())); SLOT(handleRemoteSetupRequested()));
connect(d->engine, SIGNAL(finished()), SLOT(handleProfilingFinished()));
} }
RemoteLinuxAnalyzeSupport::~RemoteLinuxAnalyzeSupport() RemoteLinuxAnalyzeSupport::~RemoteLinuxAnalyzeSupport()
@@ -111,6 +110,9 @@ void RemoteLinuxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFor
void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested() void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested()
{ {
if (d->engine->mode() != Analyzer::StartQmlRemote)
return;
QTC_ASSERT(state() == Inactive, return); QTC_ASSERT(state() == Inactive, return);
showMessage(tr("Checking available ports...\n"), Utils::NormalMessageFormat); showMessage(tr("Checking available ports...\n"), Utils::NormalMessageFormat);
@@ -154,12 +156,17 @@ void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error)
void RemoteLinuxAnalyzeSupport::handleAppRunnerFinished(bool success) void RemoteLinuxAnalyzeSupport::handleAppRunnerFinished(bool success)
{ {
// reset needs to be called first to ensure that the correct state is set.
reset();
if (!success) if (!success)
showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat); showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat);
d->engine->notifyRemoteFinished(success);
} }
void RemoteLinuxAnalyzeSupport::handleProfilingFinished() void RemoteLinuxAnalyzeSupport::handleProfilingFinished()
{ {
if (d->engine->mode() != Analyzer::StartQmlRemote)
return;
setFinished(); setFinished();
} }

View File

@@ -198,14 +198,16 @@ void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success)
else if (!success) else if (!success)
d->engine->notifyInferiorIll(); d->engine->notifyInferiorIll();
} else { } else if (state() == StartingRunner){
d->engine->notifyEngineRemoteSetupFailed(tr("Debugging failed.")); d->engine->notifyEngineRemoteSetupFailed(tr("Debugging failed."));
} }
reset();
} }
void LinuxDeviceDebugSupport::handleDebuggingFinished() void LinuxDeviceDebugSupport::handleDebuggingFinished()
{ {
setFinished(); setFinished();
reset();
} }
void LinuxDeviceDebugSupport::handleRemoteOutput(const QByteArray &output) void LinuxDeviceDebugSupport::handleRemoteOutput(const QByteArray &output)