forked from qt-creator/qt-creator
Debugger: Remove DebuggerRunControl
Use plain RunControl + DebuggerRunTool combo instead. Change-Id: Ib71b5eab50da667b9d71dcc6689d2643ad8ecdee Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -138,28 +138,30 @@ RunControl *AndroidDebugSupport::createDebugRunControl(RunConfiguration *runConf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
|
auto runControl = new ProjectExplorer::RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
new AndroidDebugSupport(runControl);
|
(void) new AndroidDebugSupport(runControl, params, errorMessage);
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl)
|
AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl,
|
||||||
: ToolRunner(runControl),
|
const Debugger::DebuggerStartParameters &sp,
|
||||||
|
QString *errorMessage)
|
||||||
|
: DebuggerRunTool(runControl, sp, errorMessage),
|
||||||
m_runner(new AndroidRunner(this, runControl->runConfiguration(), runControl->runMode()))
|
m_runner(new AndroidRunner(this, runControl->runConfiguration(), runControl->runMode()))
|
||||||
{
|
{
|
||||||
connect(runControl, &RunControl::finished,
|
connect(runControl, &RunControl::finished,
|
||||||
m_runner, &AndroidRunner::stop);
|
m_runner, &AndroidRunner::stop);
|
||||||
|
|
||||||
connect(this->runControl()->toolRunner(), &DebuggerRunTool::requestRemoteSetup,
|
connect(this, &DebuggerRunTool::requestRemoteSetup,
|
||||||
m_runner, &AndroidRunner::start);
|
m_runner, &AndroidRunner::start);
|
||||||
|
|
||||||
// FIXME: Move signal to base class and generalize handling.
|
// FIXME: Move signal to base class and generalize handling.
|
||||||
connect(this->runControl()->toolRunner(), &DebuggerRunTool::aboutToNotifyInferiorSetupOk,
|
connect(this, &DebuggerRunTool::aboutToNotifyInferiorSetupOk,
|
||||||
m_runner, &AndroidRunner::remoteDebuggerRunning);
|
m_runner, &AndroidRunner::remoteDebuggerRunning);
|
||||||
|
|
||||||
connect(m_runner, &AndroidRunner::remoteServerRunning,
|
connect(m_runner, &AndroidRunner::remoteServerRunning,
|
||||||
[this](const QByteArray &serverChannel, int pid) {
|
[this](const QByteArray &serverChannel, int pid) {
|
||||||
this->runControl()->toolRunner()->notifyEngineRemoteServerRunning(serverChannel, pid);
|
notifyEngineRemoteServerRunning(serverChannel, pid);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_runner, &AndroidRunner::remoteProcessStarted,
|
connect(m_runner, &AndroidRunner::remoteProcessStarted,
|
||||||
@@ -173,12 +175,12 @@ AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl)
|
|||||||
|
|
||||||
connect(m_runner, &AndroidRunner::remoteErrorOutput,
|
connect(m_runner, &AndroidRunner::remoteErrorOutput,
|
||||||
[this](const QString &output) {
|
[this](const QString &output) {
|
||||||
this->runControl()->toolRunner()->showMessage(output, AppError);
|
showMessage(output, AppError);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_runner, &AndroidRunner::remoteOutput,
|
connect(m_runner, &AndroidRunner::remoteOutput,
|
||||||
[this](const QString &output) {
|
[this](const QString &output) {
|
||||||
this->runControl()->toolRunner()->showMessage(output, AppOutput);
|
showMessage(output, AppOutput);
|
||||||
});
|
});
|
||||||
|
|
||||||
QTC_ASSERT(runControl, return);
|
QTC_ASSERT(runControl, return);
|
||||||
@@ -200,12 +202,7 @@ void AndroidDebugSupport::handleRemoteProcessStarted(Utils::Port gdbServerPort,
|
|||||||
result.success = true;
|
result.success = true;
|
||||||
result.gdbServerPort = gdbServerPort;
|
result.gdbServerPort = gdbServerPort;
|
||||||
result.qmlServerPort = qmlPort;
|
result.qmlServerPort = qmlPort;
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerRunControl *AndroidDebugSupport::runControl()
|
|
||||||
{
|
|
||||||
return qobject_cast<DebuggerRunControl *>(ToolRunner::runControl());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -25,30 +25,29 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <debugger/debuggerruncontrol.h>
|
||||||
|
|
||||||
#include "androidrunconfiguration.h"
|
#include "androidrunconfiguration.h"
|
||||||
|
|
||||||
namespace Debugger { class DebuggerRunControl; }
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AndroidRunner;
|
class AndroidRunner;
|
||||||
|
|
||||||
class AndroidDebugSupport : public ProjectExplorer::ToolRunner
|
class AndroidDebugSupport : public Debugger::DebuggerRunTool
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AndroidDebugSupport(ProjectExplorer::RunControl *runControl);
|
AndroidDebugSupport(ProjectExplorer::RunControl *runControl,
|
||||||
|
const Debugger::DebuggerStartParameters &sp,
|
||||||
|
QString *errorMessage);
|
||||||
|
|
||||||
static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
||||||
QString *errorMessage);
|
QString *errorMessage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlPort);
|
void handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlPort);
|
||||||
Debugger::DebuggerRunControl *runControl();
|
|
||||||
|
|
||||||
AndroidRunner * const m_runner;
|
AndroidRunner * const m_runner;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -336,8 +336,9 @@ void TestRunner::debugTests()
|
|||||||
sp.displayName = config->displayName();
|
sp.displayName = config->displayName();
|
||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
auto runControl = Debugger::createDebuggerRunControl(sp, config->runConfiguration(),
|
auto runControl = new ProjectExplorer::RunControl(config->runConfiguration(),
|
||||||
&errorMessage);
|
ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
|
(void) new Debugger::DebuggerRunTool(runControl, sp, &errorMessage);
|
||||||
|
|
||||||
if (!runControl) {
|
if (!runControl) {
|
||||||
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
|
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
|
||||||
@@ -364,18 +365,18 @@ void TestRunner::debugTests()
|
|||||||
if (useOutputProcessor) {
|
if (useOutputProcessor) {
|
||||||
TestOutputReader *outputreader = config->outputReader(*futureInterface, 0);
|
TestOutputReader *outputreader = config->outputReader(*futureInterface, 0);
|
||||||
|
|
||||||
connect(runControl, &Debugger::DebuggerRunControl::appendMessageRequested,
|
connect(runControl, &ProjectExplorer::RunControl::appendMessageRequested,
|
||||||
this, [this, outputreader]
|
this, [this, outputreader]
|
||||||
(ProjectExplorer::RunControl *, const QString &msg, Utils::OutputFormat format) {
|
(ProjectExplorer::RunControl *, const QString &msg, Utils::OutputFormat format) {
|
||||||
processOutput(outputreader, msg, format);
|
processOutput(outputreader, msg, format);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(runControl, &Debugger::DebuggerRunControl::finished,
|
connect(runControl, &ProjectExplorer::RunControl::finished,
|
||||||
outputreader, &QObject::deleteLater);
|
outputreader, &QObject::deleteLater);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(this, &TestRunner::requestStopTestRun, runControl, &ProjectExplorer::RunControl::stop);
|
connect(this, &TestRunner::requestStopTestRun, runControl, &ProjectExplorer::RunControl::stop);
|
||||||
connect(runControl, &Debugger::DebuggerRunControl::finished, this, &TestRunner::onFinished);
|
connect(runControl, &ProjectExplorer::RunControl::finished, this, &TestRunner::onFinished);
|
||||||
ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl);
|
ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ using namespace ProjectExplorer;
|
|||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl)
|
BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl, const Debugger::DebuggerStartParameters &sp)
|
||||||
: ToolRunner(runControl)
|
: Debugger::DebuggerRunTool(runControl, sp)
|
||||||
, m_appLauncher(new ProjectExplorer::ApplicationLauncher(this))
|
, m_appLauncher(new ProjectExplorer::ApplicationLauncher(this))
|
||||||
{
|
{
|
||||||
connect(this->runControl()->toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup,
|
connect(this, &Debugger::DebuggerRunTool::requestRemoteSetup,
|
||||||
this, &BareMetalDebugSupport::remoteSetupRequested);
|
this, &BareMetalDebugSupport::remoteSetupRequested);
|
||||||
connect(runControl, &RunControl::finished,
|
connect(runControl, &RunControl::finished,
|
||||||
this, &BareMetalDebugSupport::debuggingFinished);
|
this, &BareMetalDebugSupport::debuggingFinished);
|
||||||
@@ -96,12 +96,12 @@ void BareMetalDebugSupport::appRunnerFinished(bool success)
|
|||||||
|
|
||||||
if (m_state == Running) {
|
if (m_state == Running) {
|
||||||
if (!success)
|
if (!success)
|
||||||
runControl()->toolRunner()->notifyInferiorIll();
|
notifyInferiorIll();
|
||||||
} else if (m_state == StartingRunner) {
|
} else if (m_state == StartingRunner) {
|
||||||
Debugger::RemoteSetupResult result;
|
Debugger::RemoteSetupResult result;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.reason = tr("Debugging failed.");
|
result.reason = tr("Debugging failed.");
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
@@ -116,7 +116,7 @@ void BareMetalDebugSupport::appRunnerError(const QString &error)
|
|||||||
{
|
{
|
||||||
if (m_state == Running) {
|
if (m_state == Running) {
|
||||||
showMessage(error, Debugger::AppError);
|
showMessage(error, Debugger::AppError);
|
||||||
runControl()->toolRunner()->notifyInferiorIll();
|
notifyInferiorIll();
|
||||||
} else if (m_state != Inactive) {
|
} else if (m_state != Inactive) {
|
||||||
adapterSetupFailed(error);
|
adapterSetupFailed(error);
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ void BareMetalDebugSupport::adapterSetupDone()
|
|||||||
m_state = Running;
|
m_state = Running;
|
||||||
Debugger::RemoteSetupResult result;
|
Debugger::RemoteSetupResult result;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
|
void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
|
||||||
@@ -137,7 +137,7 @@ void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
|
|||||||
Debugger::RemoteSetupResult result;
|
Debugger::RemoteSetupResult result;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.reason = tr("Initial setup failed: %1").arg(error);
|
result.reason = tr("Initial setup failed: %1").arg(error);
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalDebugSupport::startExecution()
|
void BareMetalDebugSupport::startExecution()
|
||||||
@@ -188,16 +188,5 @@ void BareMetalDebugSupport::reset()
|
|||||||
m_state = Inactive;
|
m_state = Inactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalDebugSupport::showMessage(const QString &msg, int channel)
|
|
||||||
{
|
|
||||||
if (m_state != Inactive)
|
|
||||||
runControl()->toolRunner()->showMessage(msg, channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
Debugger::DebuggerRunControl *BareMetalDebugSupport::runControl()
|
|
||||||
{
|
|
||||||
return qobject_cast<Debugger::DebuggerRunControl *>(ToolRunner::runControl());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace BareMetal
|
} // namespace BareMetal
|
||||||
|
|||||||
@@ -25,21 +25,20 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <debugger/debuggerruncontrol.h>
|
||||||
|
|
||||||
namespace Debugger { class DebuggerRunControl; }
|
|
||||||
|
|
||||||
namespace ProjectExplorer { class ApplicationLauncher; }
|
namespace ProjectExplorer { class ApplicationLauncher; }
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BareMetalDebugSupport : public ProjectExplorer::ToolRunner
|
class BareMetalDebugSupport : public Debugger::DebuggerRunTool
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BareMetalDebugSupport(ProjectExplorer::RunControl *runControl);
|
BareMetalDebugSupport(ProjectExplorer::RunControl *runControl,
|
||||||
|
const Debugger::DebuggerStartParameters &sp);
|
||||||
~BareMetalDebugSupport();
|
~BareMetalDebugSupport();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -60,9 +59,6 @@ private:
|
|||||||
void startExecution();
|
void startExecution();
|
||||||
void setFinished();
|
void setFinished();
|
||||||
void reset();
|
void reset();
|
||||||
void showMessage(const QString &msg, int channel);
|
|
||||||
|
|
||||||
Debugger::DebuggerRunControl *runControl();
|
|
||||||
|
|
||||||
ProjectExplorer::ApplicationLauncher *m_appLauncher;
|
ProjectExplorer::ApplicationLauncher *m_appLauncher;
|
||||||
State m_state = Inactive;
|
State m_state = Inactive;
|
||||||
|
|||||||
@@ -135,9 +135,8 @@ RunControl *BareMetalRunControlFactory::create(
|
|||||||
if (p->startupMode() == GdbServerProvider::StartupOnNetwork)
|
if (p->startupMode() == GdbServerProvider::StartupOnNetwork)
|
||||||
sp.remoteSetupNeeded = true;
|
sp.remoteSetupNeeded = true;
|
||||||
|
|
||||||
auto runControl = createDebuggerRunControl(sp, rc, errorMessage, mode);
|
auto runControl = new RunControl(rc, mode);
|
||||||
if (runControl && sp.remoteSetupNeeded)
|
new BareMetalDebugSupport(runControl, sp);
|
||||||
new BareMetalDebugSupport(runControl);
|
|
||||||
|
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ public:
|
|||||||
|
|
||||||
const DebuggerRunParameters &runParameters() const;
|
const DebuggerRunParameters &runParameters() const;
|
||||||
DebuggerRunParameters &runParameters();
|
DebuggerRunParameters &runParameters();
|
||||||
void setRunTool(DebuggerRunTool *runTool);
|
virtual void setRunTool(DebuggerRunTool *runTool);
|
||||||
DebuggerRunTool *runTool() const;
|
DebuggerRunTool *runTool() const;
|
||||||
void startDebugger();
|
void startDebugger();
|
||||||
|
|
||||||
|
|||||||
@@ -2127,7 +2127,7 @@ void DebuggerPlugin::attachExternalApplication(RunControl *rc)
|
|||||||
rp.closeMode = DetachAtClose;
|
rp.closeMode = DetachAtClose;
|
||||||
rp.toolChainAbi = rc->abi();
|
rp.toolChainAbi = rc->abi();
|
||||||
if (RunConfiguration *runConfig = rc->runConfiguration()) {
|
if (RunConfiguration *runConfig = rc->runConfiguration()) {
|
||||||
auto runControl = new DebuggerRunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
(void) new DebuggerRunTool(runControl, rp);
|
(void) new DebuggerRunTool(runControl, rp);
|
||||||
ProjectExplorerPlugin::startRunControl(runControl);
|
ProjectExplorerPlugin::startRunControl(runControl);
|
||||||
} else {
|
} else {
|
||||||
@@ -3687,7 +3687,7 @@ void DebuggerUnitTests::testStateMachine()
|
|||||||
rp.inferior = rc->runnable().as<StandardRunnable>();
|
rp.inferior = rc->runnable().as<StandardRunnable>();
|
||||||
rp.testCase = TestNoBoundsOfCurrentFunction;
|
rp.testCase = TestNoBoundsOfCurrentFunction;
|
||||||
|
|
||||||
auto runControl = new DebuggerRunControl(rc, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
auto runControl = new RunControl(rc, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
(void) new DebuggerRunTool(runControl, rp);
|
(void) new DebuggerRunTool(runControl, rp);
|
||||||
ProjectExplorerPlugin::startRunControl(runControl);
|
ProjectExplorerPlugin::startRunControl(runControl);
|
||||||
|
|
||||||
|
|||||||
@@ -107,36 +107,7 @@ static QLatin1String engineTypeName(DebuggerEngineType et)
|
|||||||
return QLatin1String("No engine");
|
return QLatin1String("No engine");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerRunTool::start()
|
||||||
/// DebuggerRunControl
|
|
||||||
|
|
||||||
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, Core::Id runMode)
|
|
||||||
: RunControl(runConfig, runMode)
|
|
||||||
{
|
|
||||||
setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR);
|
|
||||||
setPromptToStop([&](bool *optionalPrompt) {
|
|
||||||
const QString question = tr("A debugging session is still in progress. "
|
|
||||||
"Terminating the session in the current"
|
|
||||||
" state can leave the target in an inconsistent state."
|
|
||||||
" Would you still like to terminate it?");
|
|
||||||
bool result = showPromptToStopDialog(tr("Close Debugging Session"), question,
|
|
||||||
QString(), QString(), optionalPrompt);
|
|
||||||
if (result)
|
|
||||||
disconnect(this);
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerRunControl::~DebuggerRunControl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerRunControl::start()
|
|
||||||
{
|
|
||||||
toolRunner()->startIt();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerRunTool::startIt()
|
|
||||||
{
|
{
|
||||||
Debugger::Internal::saveModeToRestore();
|
Debugger::Internal::saveModeToRestore();
|
||||||
Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId);
|
Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId);
|
||||||
@@ -209,22 +180,11 @@ void DebuggerRunTool::notifyEngineRemoteSetupFinished(const RemoteSetupResult &r
|
|||||||
m_engine->notifyEngineRemoteSetupFinished(result);
|
m_engine->notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::stop()
|
void DebuggerRunTool::stop()
|
||||||
{
|
|
||||||
m_debuggerTool->stopIt();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerRunTool::stopIt()
|
|
||||||
{
|
{
|
||||||
m_engine->quitDebugger();
|
m_engine->quitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerRunTool *DebuggerRunControl::toolRunner() const
|
|
||||||
{
|
|
||||||
// return qobject_cast<DebuggerRunTool *>(RunControl::toolRunner());
|
|
||||||
return m_debuggerTool;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerRunTool::debuggingFinished()
|
void DebuggerRunTool::debuggingFinished()
|
||||||
{
|
{
|
||||||
runControl()->reportApplicationStop();
|
runControl()->reportApplicationStop();
|
||||||
@@ -519,13 +479,25 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerStartPara
|
|||||||
DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerRunParameters &rp, QString *errorMessage)
|
DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerRunParameters &rp, QString *errorMessage)
|
||||||
: ToolRunner(runControl)
|
: ToolRunner(runControl)
|
||||||
{
|
{
|
||||||
this->runControl()->m_debuggerTool = this; // FIXME: Remove.
|
|
||||||
DebuggerRunParameters m_rp = rp;
|
DebuggerRunParameters m_rp = rp;
|
||||||
|
|
||||||
runControl->setDisplayName(m_rp.displayName);
|
runControl->setDisplayName(m_rp.displayName);
|
||||||
// QML and/or mixed are not prepared for it.
|
// QML and/or mixed are not prepared for it.
|
||||||
runControl->setSupportsReRunning(!(m_rp.languages & QmlLanguage));
|
runControl->setSupportsReRunning(!(m_rp.languages & QmlLanguage));
|
||||||
|
|
||||||
|
runControl->setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR);
|
||||||
|
runControl->setPromptToStop([&](bool *optionalPrompt) {
|
||||||
|
const QString question = tr("A debugging session is still in progress. "
|
||||||
|
"Terminating the session in the current"
|
||||||
|
" state can leave the target in an inconsistent state."
|
||||||
|
" Would you still like to terminate it?");
|
||||||
|
bool result = runControl->showPromptToStopDialog(tr("Close Debugging Session"),
|
||||||
|
question, QString(), QString(), optionalPrompt);
|
||||||
|
if (result)
|
||||||
|
disconnect(this);
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
if (Internal::fixupParameters(m_rp, runControl, m_errors)) {
|
if (Internal::fixupParameters(m_rp, runControl, m_errors)) {
|
||||||
m_engine = createEngine(m_rp.masterEngineType, m_rp, &m_errors);
|
m_engine = createEngine(m_rp.masterEngineType, m_rp, &m_errors);
|
||||||
if (!m_engine) {
|
if (!m_engine) {
|
||||||
@@ -567,11 +539,6 @@ void DebuggerRunTool::handleFinished()
|
|||||||
runControlFinished(m_engine);
|
runControlFinished(m_engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerRunControl *DebuggerRunTool::runControl() const
|
|
||||||
{
|
|
||||||
return static_cast<DebuggerRunControl *>(ToolRunner::runControl());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout)
|
void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout)
|
||||||
{
|
{
|
||||||
if (channel == ConsoleOutput)
|
if (channel == ConsoleOutput)
|
||||||
@@ -610,7 +577,7 @@ public:
|
|||||||
QTC_ASSERT(runConfig, return 0);
|
QTC_ASSERT(runConfig, return 0);
|
||||||
QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
|
QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
|
||||||
|
|
||||||
auto runControl = new DebuggerRunControl(runConfig, mode);
|
auto runControl = new RunControl(runConfig, mode);
|
||||||
(void) new DebuggerRunTool(runControl, DebuggerStartParameters(), errorMessage);
|
(void) new DebuggerRunTool(runControl, DebuggerStartParameters(), errorMessage);
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
@@ -679,7 +646,7 @@ RunControl *createAndScheduleRun(const DebuggerRunParameters &rp, Kit *kit)
|
|||||||
{
|
{
|
||||||
RunConfiguration *runConfig = dummyRunConfigForKit(kit);
|
RunConfiguration *runConfig = dummyRunConfigForKit(kit);
|
||||||
QTC_ASSERT(runConfig, return nullptr);
|
QTC_ASSERT(runConfig, return nullptr);
|
||||||
auto runControl = new DebuggerRunControl(runConfig, DebugRunMode);
|
auto runControl = new RunControl(runConfig, DebugRunMode);
|
||||||
(void) new DebuggerRunTool(runControl, rp);
|
(void) new DebuggerRunTool(runControl, rp);
|
||||||
QTC_ASSERT(runControl, return nullptr);
|
QTC_ASSERT(runControl, return nullptr);
|
||||||
ProjectExplorerPlugin::startRunControl(runControl);
|
ProjectExplorerPlugin::startRunControl(runControl);
|
||||||
@@ -687,20 +654,4 @@ RunControl *createAndScheduleRun(const DebuggerRunParameters &rp, Kit *kit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main entry point for target plugins.
|
|
||||||
*/
|
|
||||||
RunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
|
|
||||||
RunConfiguration *runConfig,
|
|
||||||
QString *errorMessage,
|
|
||||||
Core::Id runMode)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(runConfig, return nullptr);
|
|
||||||
auto runControl = new DebuggerRunControl(runConfig, runMode);
|
|
||||||
(void) new DebuggerRunTool(runControl, sp, errorMessage);
|
|
||||||
return runControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -35,13 +35,6 @@ namespace Debugger {
|
|||||||
|
|
||||||
class RemoteSetupResult;
|
class RemoteSetupResult;
|
||||||
class DebuggerStartParameters;
|
class DebuggerStartParameters;
|
||||||
class DebuggerRunControl;
|
|
||||||
|
|
||||||
DEBUGGER_EXPORT ProjectExplorer::RunControl *
|
|
||||||
createDebuggerRunControl(const DebuggerStartParameters &sp,
|
|
||||||
ProjectExplorer::RunConfiguration *runConfig,
|
|
||||||
QString *errorMessage,
|
|
||||||
Core::Id runMode = ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
|
||||||
|
|
||||||
class DEBUGGER_EXPORT DebuggerRunTool : public ProjectExplorer::ToolRunner
|
class DEBUGGER_EXPORT DebuggerRunTool : public ProjectExplorer::ToolRunner
|
||||||
{
|
{
|
||||||
@@ -57,12 +50,11 @@ public:
|
|||||||
~DebuggerRunTool();
|
~DebuggerRunTool();
|
||||||
|
|
||||||
Internal::DebuggerEngine *engine() const { return m_engine; }
|
Internal::DebuggerEngine *engine() const { return m_engine; }
|
||||||
DebuggerRunControl *runControl() const;
|
|
||||||
|
|
||||||
void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1);
|
void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1);
|
||||||
|
|
||||||
void startIt();
|
void start() override;
|
||||||
void stopIt();
|
void stop() override;
|
||||||
|
|
||||||
void handleFinished();
|
void handleFinished();
|
||||||
|
|
||||||
@@ -87,21 +79,4 @@ private:
|
|||||||
QStringList m_errors;
|
QStringList m_errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DEBUGGER_EXPORT DebuggerRunControl : public ProjectExplorer::RunControl
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode);
|
|
||||||
~DebuggerRunControl() override;
|
|
||||||
|
|
||||||
void start() override;
|
|
||||||
void stop() override; // Called from SnapshotWindow.
|
|
||||||
|
|
||||||
DebuggerRunTool *toolRunner() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DebuggerRunTool *m_debuggerTool = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -3331,7 +3331,7 @@ void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QStri
|
|||||||
}
|
}
|
||||||
rp.displayName = function + ": " + QDateTime::currentDateTime().toString();
|
rp.displayName = function + ": " + QDateTime::currentDateTime().toString();
|
||||||
rp.isSnapshot = true;
|
rp.isSnapshot = true;
|
||||||
auto rc = new DebuggerRunControl(runControl()->runConfiguration(), ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
auto rc = new RunControl(runControl()->runConfiguration(), ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
(void) new DebuggerRunTool(rc, rp);
|
(void) new DebuggerRunTool(rc, rp);
|
||||||
ProjectExplorerPlugin::startRunControl(rc);
|
ProjectExplorerPlugin::startRunControl(rc);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -335,10 +335,6 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
|
|||||||
|
|
||||||
connect(d->msgClient, &QDebugMessageClient::message,
|
connect(d->msgClient, &QDebugMessageClient::message,
|
||||||
this, &appendDebugOutput);
|
this, &appendDebugOutput);
|
||||||
|
|
||||||
d->startupMessageFilterConnection = connect(
|
|
||||||
runControl(), &RunControl::appendMessageRequested,
|
|
||||||
d, &QmlEnginePrivate::filterApplicationMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlEngine::~QmlEngine()
|
QmlEngine::~QmlEngine()
|
||||||
@@ -356,6 +352,15 @@ QmlEngine::~QmlEngine()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlEngine::setRunTool(DebuggerRunTool *runTool)
|
||||||
|
{
|
||||||
|
DebuggerEngine::setRunTool(runTool);
|
||||||
|
|
||||||
|
d->startupMessageFilterConnection = connect(
|
||||||
|
runTool->runControl(), &RunControl::appendMessageRequested,
|
||||||
|
d, &QmlEnginePrivate::filterApplicationMessage);
|
||||||
|
}
|
||||||
|
|
||||||
void QmlEngine::setupInferior()
|
void QmlEngine::setupInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public:
|
|||||||
DebuggerEngine *masterEngine = nullptr);
|
DebuggerEngine *masterEngine = nullptr);
|
||||||
~QmlEngine() override;
|
~QmlEngine() override;
|
||||||
|
|
||||||
|
void setRunTool(DebuggerRunTool *runTool) override;
|
||||||
|
|
||||||
void logServiceStateChange(const QString &service, float version,
|
void logServiceStateChange(const QString &service, float version,
|
||||||
QmlDebug::QmlDebugClient::State newState);
|
QmlDebug::QmlDebugClient::State newState);
|
||||||
void logServiceActivity(const QString &service, const QString &logMessage);
|
void logServiceActivity(const QString &service, const QString &logMessage);
|
||||||
|
|||||||
@@ -155,18 +155,18 @@ RunControl *IosDebugSupport::createDebugRunControl(RunConfiguration *runConfig,
|
|||||||
params.startMode = AttachToRemoteServer;
|
params.startMode = AttachToRemoteServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
|
Q_UNUSED(errorMessage); // FIXME
|
||||||
if (runControl)
|
auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
new IosDebugSupport(runControl, cppDebug, qmlDebug);
|
(void) new IosDebugSupport(runControl, params, cppDebug, qmlDebug);
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
IosDebugSupport::IosDebugSupport(RunControl *runControl, bool cppDebug, bool qmlDebug)
|
IosDebugSupport::IosDebugSupport(RunControl *runControl, const DebuggerStartParameters &sp, bool cppDebug, bool qmlDebug)
|
||||||
: ToolRunner(runControl),
|
: Debugger::DebuggerRunTool(runControl, sp),
|
||||||
m_runner(new IosRunner(this, runControl, cppDebug,
|
m_runner(new IosRunner(this, runControl, cppDebug,
|
||||||
qmlDebug ? QmlDebug::QmlDebuggerServices : QmlDebug::NoQmlDebugServices))
|
qmlDebug ? QmlDebug::QmlDebuggerServices : QmlDebug::NoQmlDebugServices))
|
||||||
{
|
{
|
||||||
connect(this->runControl()->toolRunner(), &DebuggerRunTool::requestRemoteSetup,
|
connect(this, &Debugger::DebuggerRunTool::requestRemoteSetup,
|
||||||
m_runner, &IosRunner::start);
|
m_runner, &IosRunner::start);
|
||||||
connect(runControl, &RunControl::finished,
|
connect(runControl, &RunControl::finished,
|
||||||
m_runner, &IosRunner::stop);
|
m_runner, &IosRunner::stop);
|
||||||
@@ -193,7 +193,7 @@ void IosDebugSupport::handleServerPorts(Utils::Port gdbServerPort, Utils::Port q
|
|||||||
|| (m_runner && !m_runner->cppDebug() && qmlPort.isValid());
|
|| (m_runner && !m_runner->cppDebug() && qmlPort.isValid());
|
||||||
if (!result.success)
|
if (!result.success)
|
||||||
result.reason = tr("Could not get debug server file descriptor.");
|
result.reason = tr("Could not get debug server file descriptor.");
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort)
|
void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort)
|
||||||
@@ -204,7 +204,7 @@ void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort)
|
|||||||
result.success = pid > 0;
|
result.success = pid > 0;
|
||||||
if (!result.success)
|
if (!result.success)
|
||||||
result.reason = tr("Got an invalid process id.");
|
result.reason = tr("Got an invalid process id.");
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
|
void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
|
||||||
@@ -213,22 +213,17 @@ void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
|
|||||||
appendMessage(tr("Run ended with error."), Utils::DebugFormat);
|
appendMessage(tr("Run ended with error."), Utils::DebugFormat);
|
||||||
else
|
else
|
||||||
appendMessage(tr("Run ended."), Utils::DebugFormat);
|
appendMessage(tr("Run ended."), Utils::DebugFormat);
|
||||||
runControl()->toolRunner()->abortDebugger();
|
abortDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosDebugSupport::handleRemoteOutput(const QString &output)
|
void IosDebugSupport::handleRemoteOutput(const QString &output)
|
||||||
{
|
{
|
||||||
runControl()->toolRunner()->showMessage(output, AppOutput);
|
showMessage(output, AppOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosDebugSupport::handleRemoteErrorOutput(const QString &output)
|
void IosDebugSupport::handleRemoteErrorOutput(const QString &output)
|
||||||
{
|
{
|
||||||
runControl()->toolRunner()->showMessage(output, AppError);
|
showMessage(output, AppError);
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerRunControl *IosDebugSupport::runControl()
|
|
||||||
{
|
|
||||||
return qobject_cast<DebuggerRunControl *>(ToolRunner::runControl()) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -27,10 +27,7 @@
|
|||||||
|
|
||||||
#include "iosrunconfiguration.h"
|
#include "iosrunconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <debugger/debuggerruncontrol.h>
|
||||||
|
|
||||||
namespace Debugger { class DebuggerRunControl; }
|
|
||||||
namespace ProjectExplorer { class RunControl; }
|
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -38,7 +35,7 @@ namespace Internal {
|
|||||||
class IosRunConfiguration;
|
class IosRunConfiguration;
|
||||||
class IosRunner;
|
class IosRunner;
|
||||||
|
|
||||||
class IosDebugSupport : public ProjectExplorer::ToolRunner
|
class IosDebugSupport : public Debugger::DebuggerRunTool
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -46,7 +43,9 @@ public:
|
|||||||
static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
||||||
QString *errorMessage);
|
QString *errorMessage);
|
||||||
|
|
||||||
IosDebugSupport(ProjectExplorer::RunControl *runControl, bool cppDebug, bool qmlDebug);
|
IosDebugSupport(ProjectExplorer::RunControl *runControl,
|
||||||
|
const Debugger::DebuggerStartParameters &sp,
|
||||||
|
bool cppDebug, bool qmlDebug);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleServerPorts(Utils::Port gdbServerPort, Utils::Port qmlPort);
|
void handleServerPorts(Utils::Port gdbServerPort, Utils::Port qmlPort);
|
||||||
@@ -56,8 +55,6 @@ private:
|
|||||||
void handleRemoteOutput(const QString &output);
|
void handleRemoteOutput(const QString &output);
|
||||||
void handleRemoteErrorOutput(const QString &output);
|
void handleRemoteErrorOutput(const QString &output);
|
||||||
|
|
||||||
Debugger::DebuggerRunControl *runControl();
|
|
||||||
|
|
||||||
IosRunner * const m_runner;
|
IosRunner * const m_runner;
|
||||||
const QString m_dumperLib;
|
const QString m_dumperLib;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ void QnxAttachDebugSupport::attachToProcess()
|
|||||||
sp.solibSearchPath = QnxUtils::searchPaths(qtVersion);
|
sp.solibSearchPath = QnxUtils::searchPaths(qtVersion);
|
||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
auto runControl = Debugger::createDebuggerRunControl(sp, 0, &errorMessage);
|
auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
|
(void) new Debugger::DebuggerRunTool(runControl, sp, &errorMessage);
|
||||||
if (!errorMessage.isEmpty()) {
|
if (!errorMessage.isEmpty()) {
|
||||||
handleError(errorMessage);
|
handleError(errorMessage);
|
||||||
stopPDebug();
|
stopPDebug();
|
||||||
@@ -159,20 +160,20 @@ void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState s
|
|||||||
|
|
||||||
void QnxAttachDebugSupport::handleError(const QString &message)
|
void QnxAttachDebugSupport::handleError(const QString &message)
|
||||||
{
|
{
|
||||||
if (m_runControl)
|
if (m_runTool)
|
||||||
m_runControl->toolRunner()->showMessage(message, Debugger::AppError);
|
m_runTool->showMessage(message, Debugger::AppError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAttachDebugSupport::handleProgressReport(const QString &message)
|
void QnxAttachDebugSupport::handleProgressReport(const QString &message)
|
||||||
{
|
{
|
||||||
if (m_runControl)
|
if (m_runTool)
|
||||||
m_runControl->toolRunner()->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff);
|
m_runTool->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAttachDebugSupport::handleRemoteOutput(const QByteArray &output)
|
void QnxAttachDebugSupport::handleRemoteOutput(const QByteArray &output)
|
||||||
{
|
{
|
||||||
if (m_runControl)
|
if (m_runTool)
|
||||||
m_runControl->toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
|
m_runTool->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAttachDebugSupport::stopPDebug()
|
void QnxAttachDebugSupport::stopPDebug()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
namespace Debugger { class DebuggerRunControl; }
|
namespace Debugger { class DebuggerRunTool; }
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class ApplicationLauncher;
|
class ApplicationLauncher;
|
||||||
@@ -70,7 +70,7 @@ private:
|
|||||||
|
|
||||||
ProjectExplorer::ApplicationLauncher *m_launcher;
|
ProjectExplorer::ApplicationLauncher *m_launcher;
|
||||||
ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer;
|
ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer;
|
||||||
Debugger::DebuggerRunControl *m_runControl = 0;
|
Debugger::DebuggerRunTool *m_runTool = 0;
|
||||||
|
|
||||||
Utils::Port m_pdebugPort;
|
Utils::Port m_pdebugPort;
|
||||||
QString m_projectSourceDirectory;
|
QString m_projectSourceDirectory;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ QnxDebugSupport::QnxDebugSupport(RunControl *runControl)
|
|||||||
connect(runner, &ApplicationLauncher::remoteStdout, this, &QnxDebugSupport::handleRemoteOutput);
|
connect(runner, &ApplicationLauncher::remoteStdout, this, &QnxDebugSupport::handleRemoteOutput);
|
||||||
connect(runner, &ApplicationLauncher::remoteStderr, this, &QnxDebugSupport::handleRemoteOutput);
|
connect(runner, &ApplicationLauncher::remoteStderr, this, &QnxDebugSupport::handleRemoteOutput);
|
||||||
|
|
||||||
connect(this->runControl()->toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup,
|
connect(toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup,
|
||||||
this, &QnxDebugSupport::handleAdapterSetupRequested);
|
this, &QnxDebugSupport::handleAdapterSetupRequested);
|
||||||
connect(runControl, &RunControl::finished,
|
connect(runControl, &RunControl::finished,
|
||||||
this, &QnxDebugSupport::handleDebuggingFinished);
|
this, &QnxDebugSupport::handleDebuggingFinished);
|
||||||
@@ -82,7 +82,7 @@ void QnxDebugSupport::handleAdapterSetupRequested()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == Inactive, return);
|
QTC_ASSERT(state() == Inactive, return);
|
||||||
|
|
||||||
runControl()->toolRunner()->showMessage(tr("Preparing remote side...") + '\n', Debugger::AppStuff);
|
toolRunner()->showMessage(tr("Preparing remote side...") + '\n', Debugger::AppStuff);
|
||||||
QnxAbstractRunSupport::handleAdapterSetupRequested();
|
QnxAbstractRunSupport::handleAdapterSetupRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ void QnxDebugSupport::handleRemoteProcessStarted()
|
|||||||
result.success = true;
|
result.success = true;
|
||||||
result.gdbServerPort = m_pdebugPort;
|
result.gdbServerPort = m_pdebugPort;
|
||||||
result.qmlServerPort = m_qmlPort;
|
result.qmlServerPort = m_qmlPort;
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
toolRunner()->notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxDebugSupport::handleRemoteProcessFinished(bool success)
|
void QnxDebugSupport::handleRemoteProcessFinished(bool success)
|
||||||
@@ -134,13 +134,13 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success)
|
|||||||
|
|
||||||
if (state() == Running) {
|
if (state() == Running) {
|
||||||
if (!success)
|
if (!success)
|
||||||
runControl()->toolRunner()->notifyInferiorIll();
|
toolRunner()->notifyInferiorIll();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Debugger::RemoteSetupResult result;
|
Debugger::RemoteSetupResult result;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.reason = tr("The %1 process closed unexpectedly.").arg(processExecutable());
|
result.reason = tr("The %1 process closed unexpectedly.").arg(processExecutable());
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
toolRunner()->notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,44 +166,44 @@ void QnxDebugSupport::killInferiorProcess()
|
|||||||
|
|
||||||
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
|
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
|
||||||
{
|
{
|
||||||
runControl()->toolRunner()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
|
toolRunner()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxDebugSupport::handleRemoteOutput(const QByteArray &output)
|
void QnxDebugSupport::handleRemoteOutput(const QByteArray &output)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == Inactive || state() == Running, return);
|
QTC_ASSERT(state() == Inactive || state() == Running, return);
|
||||||
runControl()->toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
|
toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxDebugSupport::handleError(const QString &error)
|
void QnxDebugSupport::handleError(const QString &error)
|
||||||
{
|
{
|
||||||
if (state() == Running) {
|
if (state() == Running) {
|
||||||
runControl()->toolRunner()->showMessage(error, Debugger::AppError);
|
toolRunner()->showMessage(error, Debugger::AppError);
|
||||||
runControl()->toolRunner()->notifyInferiorIll();
|
toolRunner()->notifyInferiorIll();
|
||||||
} else if (state() != Inactive) {
|
} else if (state() != Inactive) {
|
||||||
setFinished();
|
setFinished();
|
||||||
Debugger::RemoteSetupResult result;
|
Debugger::RemoteSetupResult result;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.reason = tr("Initial setup failed: %1").arg(error);
|
result.reason = tr("Initial setup failed: %1").arg(error);
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
toolRunner()->notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxDebugSupport::printMissingWarning()
|
void QnxDebugSupport::printMissingWarning()
|
||||||
{
|
{
|
||||||
runControl()->toolRunner()->showMessage(tr("Warning: \"slog2info\" is not found "
|
toolRunner()->showMessage(tr("Warning: \"slog2info\" is not found "
|
||||||
"on the device, debug output not available."), Debugger::AppError);
|
"on the device, debug output not available."), Debugger::AppError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat)
|
void QnxDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat)
|
||||||
{
|
{
|
||||||
Q_UNUSED(outputFormat);
|
Q_UNUSED(outputFormat);
|
||||||
runControl()->toolRunner()->showMessage(msg, Debugger::AppOutput);
|
toolRunner()->showMessage(msg, Debugger::AppOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debugger::DebuggerRunControl *QnxDebugSupport::runControl()
|
Debugger::DebuggerRunTool *QnxDebugSupport::toolRunner()
|
||||||
{
|
{
|
||||||
return qobject_cast<Debugger::DebuggerRunControl *>(QnxAbstractRunSupport::runControl());
|
return qobject_cast<Debugger::DebuggerRunTool *>(runControl()->toolRunner());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <utils/outputformat.h>
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
namespace Debugger { class DebuggerRunControl; }
|
namespace Debugger { class DebuggerRunTool; }
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
|
|
||||||
void startExecution() override;
|
void startExecution() override;
|
||||||
|
|
||||||
Debugger::DebuggerRunControl *runControl();
|
Debugger::DebuggerRunTool *toolRunner();
|
||||||
QString processExecutable() const;
|
QString processExecutable() const;
|
||||||
|
|
||||||
void killInferiorProcess();
|
void killInferiorProcess();
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
|
|||||||
|
|
||||||
if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE) {
|
if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE) {
|
||||||
const DebuggerStartParameters params = createDebuggerStartParameters(rc);
|
const DebuggerStartParameters params = createDebuggerStartParameters(rc);
|
||||||
auto runControl = createDebuggerRunControl(params, runConfig, errorMessage);
|
auto runControl = new RunControl(runConfig, mode);
|
||||||
QTC_ASSERT(runControl, return 0);
|
// (void) new DebuggerRunTool(runControl, params, errorMessage); FIXME
|
||||||
(void) new QnxDebugSupport(runControl);
|
(void) new QnxDebugSupport(runControl);
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace Internal {
|
|||||||
class AbstractRemoteLinuxRunSupportPrivate
|
class AbstractRemoteLinuxRunSupportPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ApplicationLauncher launcher;
|
||||||
AbstractRemoteLinuxRunSupport::State state = AbstractRemoteLinuxRunSupport::Inactive;
|
AbstractRemoteLinuxRunSupport::State state = AbstractRemoteLinuxRunSupport::Inactive;
|
||||||
DeviceUsedPortsGatherer portsGatherer;
|
DeviceUsedPortsGatherer portsGatherer;
|
||||||
ApplicationLauncher fifoCreator;
|
ApplicationLauncher fifoCreator;
|
||||||
@@ -53,7 +54,7 @@ public:
|
|||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RunControl *runControl)
|
AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RunControl *runControl)
|
||||||
: SimpleTargetRunner(runControl),
|
: TargetRunner(runControl),
|
||||||
d(new AbstractRemoteLinuxRunSupportPrivate)
|
d(new AbstractRemoteLinuxRunSupportPrivate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -64,6 +65,11 @@ AbstractRemoteLinuxRunSupport::~AbstractRemoteLinuxRunSupport()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApplicationLauncher *AbstractRemoteLinuxRunSupport::applicationLauncher()
|
||||||
|
{
|
||||||
|
return &d->launcher;
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxRunSupport::setState(AbstractRemoteLinuxRunSupport::State state)
|
void AbstractRemoteLinuxRunSupport::setState(AbstractRemoteLinuxRunSupport::State state)
|
||||||
{
|
{
|
||||||
d->state = state;
|
d->state = state;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace RemoteLinux {
|
|||||||
|
|
||||||
namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; }
|
namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; }
|
||||||
|
|
||||||
class REMOTELINUX_EXPORT AbstractRemoteLinuxRunSupport : public ProjectExplorer::SimpleTargetRunner
|
class REMOTELINUX_EXPORT AbstractRemoteLinuxRunSupport : public ProjectExplorer::TargetRunner
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -52,6 +52,8 @@ public:
|
|||||||
explicit AbstractRemoteLinuxRunSupport(ProjectExplorer::RunControl *runControl);
|
explicit AbstractRemoteLinuxRunSupport(ProjectExplorer::RunControl *runControl);
|
||||||
~AbstractRemoteLinuxRunSupport();
|
~AbstractRemoteLinuxRunSupport();
|
||||||
|
|
||||||
|
ProjectExplorer::ApplicationLauncher *applicationLauncher();
|
||||||
|
|
||||||
void setState(State state);
|
void setState(State state);
|
||||||
State state() const;
|
State state() const;
|
||||||
|
|
||||||
|
|||||||
@@ -107,12 +107,6 @@ bool LinuxDeviceDebugSupport::isQmlDebugging() const
|
|||||||
return d->qmlDebugging;
|
return d->qmlDebugging;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
|
|
||||||
{
|
|
||||||
if (state() != AbstractRemoteLinuxRunSupport::Inactive)
|
|
||||||
runControl()->toolRunner()->showMessage(msg, channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractRemoteLinuxRunSupport *LinuxDeviceDebugSupport::targetRunner() const
|
AbstractRemoteLinuxRunSupport *LinuxDeviceDebugSupport::targetRunner() const
|
||||||
{
|
{
|
||||||
return qobject_cast<AbstractRemoteLinuxRunSupport *>(runControl()->targetRunner());
|
return qobject_cast<AbstractRemoteLinuxRunSupport *>(runControl()->targetRunner());
|
||||||
@@ -200,7 +194,7 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
|
|||||||
{
|
{
|
||||||
if (state() == AbstractRemoteLinuxRunSupport::Running) {
|
if (state() == AbstractRemoteLinuxRunSupport::Running) {
|
||||||
showMessage(error, AppError);
|
showMessage(error, AppError);
|
||||||
runControl()->toolRunner()->notifyInferiorIll();
|
notifyInferiorIll();
|
||||||
} else if (state() != AbstractRemoteLinuxRunSupport::Inactive) {
|
} else if (state() != AbstractRemoteLinuxRunSupport::Inactive) {
|
||||||
handleAdapterSetupFailed(error);
|
handleAdapterSetupFailed(error);
|
||||||
}
|
}
|
||||||
@@ -214,15 +208,15 @@ void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success)
|
|||||||
if (state() == AbstractRemoteLinuxRunSupport::Running) {
|
if (state() == AbstractRemoteLinuxRunSupport::Running) {
|
||||||
// The QML engine does not realize on its own that the application has finished.
|
// The QML engine does not realize on its own that the application has finished.
|
||||||
if (d->qmlDebugging && !d->cppDebugging)
|
if (d->qmlDebugging && !d->cppDebugging)
|
||||||
runControl()->toolRunner()->quitDebugger();
|
quitDebugger();
|
||||||
else if (!success)
|
else if (!success)
|
||||||
runControl()->toolRunner()->notifyInferiorIll();
|
notifyInferiorIll();
|
||||||
|
|
||||||
} else if (state() == AbstractRemoteLinuxRunSupport::StartingRunner) {
|
} else if (state() == AbstractRemoteLinuxRunSupport::StartingRunner) {
|
||||||
RemoteSetupResult result;
|
RemoteSetupResult result;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.reason = tr("Debugging failed.");
|
result.reason = tr("Debugging failed.");
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
targetRunner()->reset();
|
targetRunner()->reset();
|
||||||
}
|
}
|
||||||
@@ -265,7 +259,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupFailed(const QString &error)
|
|||||||
RemoteSetupResult result;
|
RemoteSetupResult result;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.reason = tr("Initial setup failed: %1").arg(error);
|
result.reason = tr("Initial setup failed: %1").arg(error);
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDeviceDebugSupport::handleAdapterSetupDone()
|
void LinuxDeviceDebugSupport::handleAdapterSetupDone()
|
||||||
@@ -276,7 +270,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupDone()
|
|||||||
result.success = true;
|
result.success = true;
|
||||||
result.gdbServerPort = d->gdbServerPort;
|
result.gdbServerPort = d->gdbServerPort;
|
||||||
result.qmlServerPort = d->qmlPort;
|
result.qmlServerPort = d->qmlPort;
|
||||||
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
|
notifyEngineRemoteSetupFinished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDeviceDebugSupport::handleRemoteProcessStarted()
|
void LinuxDeviceDebugSupport::handleRemoteProcessStarted()
|
||||||
|
|||||||
@@ -63,8 +63,6 @@ private:
|
|||||||
void handleAdapterSetupDone();
|
void handleAdapterSetupDone();
|
||||||
void handleDebuggingFinished();
|
void handleDebuggingFinished();
|
||||||
|
|
||||||
void showMessage(const QString &msg, int channel);
|
|
||||||
|
|
||||||
AbstractRemoteLinuxRunSupport *targetRunner() const;
|
AbstractRemoteLinuxRunSupport *targetRunner() const;
|
||||||
AbstractRemoteLinuxRunSupport::State state() const;
|
AbstractRemoteLinuxRunSupport::State state() const;
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
|
|||||||
params.symbolFile = symbolFile;
|
params.symbolFile = symbolFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto runControl = new DebuggerRunControl(runConfig, mode);
|
auto runControl = new RunControl(runConfig, mode);
|
||||||
(void) new AbstractRemoteLinuxRunSupport(runControl);
|
(void) new AbstractRemoteLinuxRunSupport(runControl);
|
||||||
(void) new LinuxDeviceDebugSupport(runControl, params, errorMessage);
|
(void) new LinuxDeviceDebugSupport(runControl, params, errorMessage);
|
||||||
return runControl;
|
return runControl;
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ void MemcheckWithGdbRunControl::startDebugger()
|
|||||||
sp.expectedSignals.append("SIGTRAP");
|
sp.expectedSignals.append("SIGTRAP");
|
||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
RunControl *gdbRunControl = Debugger::createDebuggerRunControl(sp, runConfiguration(), &errorMessage);
|
auto *gdbRunControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
QTC_ASSERT(gdbRunControl, return);
|
(void) new Debugger::DebuggerRunTool(gdbRunControl, sp, &errorMessage);
|
||||||
connect(gdbRunControl, &RunControl::finished,
|
connect(gdbRunControl, &RunControl::finished,
|
||||||
gdbRunControl, &RunControl::deleteLater);
|
gdbRunControl, &RunControl::deleteLater);
|
||||||
gdbRunControl->initiateStart();
|
gdbRunControl->initiateStart();
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
server.close();
|
server.close();
|
||||||
auto debugRunControl
|
auto debugRunControl = new RunControl(runConfig, mode);
|
||||||
= createDebuggerRunControl(params, runConfig, errorMessage, mode);
|
(void) new Debugger::DebuggerRunTool(debugRunControl, params, errorMessage);
|
||||||
runner->setDebugRunControl(debugRunControl);
|
runner->setDebugRunControl(debugRunControl);
|
||||||
new WinRtDebugSupport(debugRunControl, runner);
|
new WinRtDebugSupport(debugRunControl, runner);
|
||||||
return debugRunControl;
|
return debugRunControl;
|
||||||
|
|||||||
Reference in New Issue
Block a user