Debugger et al: Move code from DebuggerRunControl to DebuggerRunTool

It's tool specific, so put it into the tool (only) related code.

The additional level of indirection will go again, plus the original
one will be removed once the *DebugSupport classes can directly
use DebuggerRunTool as base.

Change-Id: Ieaa386a0f7d724b09cedaaba8fb7d1e6dc4ad55b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2017-04-21 17:20:57 +02:00
parent e720e72a25
commit 07884645af
13 changed files with 142 additions and 136 deletions

View File

@@ -159,7 +159,7 @@ AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl)
connect(m_runner, &AndroidRunner::remoteServerRunning, connect(m_runner, &AndroidRunner::remoteServerRunning,
[this](const QByteArray &serverChannel, int pid) { [this](const QByteArray &serverChannel, int pid) {
this->runControl()->notifyEngineRemoteServerRunning(serverChannel, pid); this->runControl()->toolRunner()->notifyEngineRemoteServerRunning(serverChannel, pid);
}); });
connect(m_runner, &AndroidRunner::remoteProcessStarted, connect(m_runner, &AndroidRunner::remoteProcessStarted,
@@ -173,12 +173,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()->showMessage(output, AppError); this->runControl()->toolRunner()->showMessage(output, AppError);
}); });
connect(m_runner, &AndroidRunner::remoteOutput, connect(m_runner, &AndroidRunner::remoteOutput,
[this](const QString &output) { [this](const QString &output) {
this->runControl()->showMessage(output, AppOutput); this->runControl()->toolRunner()->showMessage(output, AppOutput);
}); });
QTC_ASSERT(runControl, return); QTC_ASSERT(runControl, return);
@@ -200,7 +200,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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
DebuggerRunControl *AndroidDebugSupport::runControl() DebuggerRunControl *AndroidDebugSupport::runControl()

View File

@@ -96,12 +96,12 @@ void BareMetalDebugSupport::appRunnerFinished(bool success)
if (m_state == Running) { if (m_state == Running) {
if (!success) if (!success)
runControl()->notifyInferiorIll(); runControl()->toolRunner()->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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->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()->notifyInferiorIll(); runControl()->toolRunner()->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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
void BareMetalDebugSupport::startExecution() void BareMetalDebugSupport::startExecution()
@@ -191,7 +191,7 @@ void BareMetalDebugSupport::reset()
void BareMetalDebugSupport::showMessage(const QString &msg, int channel) void BareMetalDebugSupport::showMessage(const QString &msg, int channel)
{ {
if (m_state != Inactive) if (m_state != Inactive)
runControl()->showMessage(msg, channel); runControl()->toolRunner()->showMessage(msg, channel);
} }
Debugger::DebuggerRunControl *BareMetalDebugSupport::runControl() Debugger::DebuggerRunControl *BareMetalDebugSupport::runControl()

View File

@@ -341,13 +341,14 @@ public:
DebuggerState state() const { return m_state; } DebuggerState state() const { return m_state; }
RemoteSetupState remoteSetupState() const { return m_remoteSetupState; } RemoteSetupState remoteSetupState() const { return m_remoteSetupState; }
bool isMasterEngine() const { return m_engine->isMasterEngine(); } bool isMasterEngine() const { return m_engine->isMasterEngine(); }
DebuggerRunControl *runControl() const DebuggerRunTool *runTool() const
{ return m_masterEngine ? m_masterEngine->runControl() : m_runControl; } { return m_masterEngine ? m_masterEngine->runTool() : m_runTool.data(); }
DebuggerRunControl *runControl() const { return runTool()->runControl(); }
void setRemoteSetupState(RemoteSetupState state); void setRemoteSetupState(RemoteSetupState state);
DebuggerEngine *m_engine = nullptr; // Not owned. DebuggerEngine *m_engine = nullptr; // Not owned.
DebuggerEngine *m_masterEngine = nullptr; // Not owned DebuggerEngine *m_masterEngine = nullptr; // Not owned
DebuggerRunControl *m_runControl = nullptr; // Not owned. QPointer<DebuggerRunTool> m_runTool; // Not owned.
DebuggerRunParameters m_runParameters; DebuggerRunParameters m_runParameters;
@@ -554,10 +555,15 @@ void DebuggerEngine::setRegisterValue(const QString &name, const QString &value)
Q_UNUSED(value); Q_UNUSED(value);
} }
void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) void DebuggerEngine::setRunTool(DebuggerRunTool *runTool)
{ {
QTC_ASSERT(runControl, notifyEngineSetupFailed(); return); QTC_ASSERT(!d->m_runTool, notifyEngineSetupFailed(); return);
QTC_ASSERT(!d->m_runControl, notifyEngineSetupFailed(); return); d->m_runTool = runTool;
}
void DebuggerEngine::startDebugger()
{
QTC_ASSERT(d->m_runTool, notifyEngineSetupFailed(); return);
d->m_progress.setProgressRange(0, 1000); d->m_progress.setProgressRange(0, 1000);
FutureProgress *fp = ProgressManager::addTask(d->m_progress.future(), FutureProgress *fp = ProgressManager::addTask(d->m_progress.future(),
@@ -566,12 +572,10 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
fp->setKeepOnFinish(FutureProgress::HideOnFinish); fp->setKeepOnFinish(FutureProgress::HideOnFinish);
d->m_progress.reportStarted(); d->m_progress.reportStarted();
d->m_runControl = runControl;
d->m_inferiorPid = d->m_runParameters.attachPID.isValid() d->m_inferiorPid = d->m_runParameters.attachPID.isValid()
? d->m_runParameters.attachPID : ProcessHandle(); ? d->m_runParameters.attachPID : ProcessHandle();
if (d->m_inferiorPid.isValid()) if (d->m_inferiorPid.isValid())
d->m_runControl->setApplicationProcessHandle(d->m_inferiorPid); runControl()->setApplicationProcessHandle(d->m_inferiorPid);
if (isNativeMixedActive()) if (isNativeMixedActive())
d->m_runParameters.inferior.environment.set("QV4_FORCE_INTERPRETER", "1"); d->m_runParameters.inferior.environment.set("QV4_FORCE_INTERPRETER", "1");
@@ -586,14 +590,14 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
d->m_terminal.setup(); d->m_terminal.setup();
if (d->m_terminal.isUsable()) { if (d->m_terminal.isUsable()) {
connect(&d->m_terminal, &Terminal::stdOutReady, [this, runControl](const QString &msg) { connect(&d->m_terminal, &Terminal::stdOutReady, [this](const QString &msg) {
runControl->appendMessage(msg, Utils::StdOutFormatSameLine); d->m_runTool->appendMessage(msg, Utils::StdOutFormatSameLine);
}); });
connect(&d->m_terminal, &Terminal::stdErrReady, [this, runControl](const QString &msg) { connect(&d->m_terminal, &Terminal::stdErrReady, [this](const QString &msg) {
runControl->appendMessage(msg, Utils::StdErrFormatSameLine); d->m_runTool->appendMessage(msg, Utils::StdErrFormatSameLine);
}); });
connect(&d->m_terminal, &Terminal::error, [this, runControl](const QString &msg) { connect(&d->m_terminal, &Terminal::error, [this](const QString &msg) {
runControl->appendMessage(msg, Utils::ErrorMessageFormat); d->m_runTool->appendMessage(msg, Utils::ErrorMessageFormat);
}); });
} }
@@ -642,7 +646,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
void DebuggerEngine::handleStartFailed() void DebuggerEngine::handleStartFailed()
{ {
showMessage("HANDLE RUNCONTROL START FAILED"); showMessage("HANDLE RUNCONTROL START FAILED");
d->m_runControl = 0; d->m_runTool.clear();
d->m_progress.setProgressValue(900); d->m_progress.setProgressValue(900);
d->m_progress.reportCanceled(); d->m_progress.reportCanceled();
d->m_progress.reportFinished(); d->m_progress.reportFinished();
@@ -652,7 +656,7 @@ void DebuggerEngine::handleStartFailed()
void DebuggerEngine::handleFinished() void DebuggerEngine::handleFinished()
{ {
showMessage("HANDLE RUNCONTROL FINISHED"); showMessage("HANDLE RUNCONTROL FINISHED");
d->m_runControl = 0; d->m_runTool.clear();
d->m_progress.setProgressValue(1000); d->m_progress.setProgressValue(1000);
d->m_progress.reportFinished(); d->m_progress.reportFinished();
modulesHandler()->removeAll(); modulesHandler()->removeAll();
@@ -784,8 +788,8 @@ void DebuggerEngine::notifyEngineSetupFailed()
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << this << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << this << state());
setState(EngineSetupFailed); setState(EngineSetupFailed);
if (isMasterEngine() && runControl()) if (isMasterEngine() && runTool())
runControl()->startFailed(); runTool()->startFailed();
setState(DebuggerFinished); setState(DebuggerFinished);
} }
@@ -1122,8 +1126,8 @@ void DebuggerEnginePrivate::doFinishDebugger()
{ {
m_engine->showMessage("NOTE: FINISH DEBUGGER"); m_engine->showMessage("NOTE: FINISH DEBUGGER");
QTC_ASSERT(state() == DebuggerFinished, qDebug() << m_engine << state()); QTC_ASSERT(state() == DebuggerFinished, qDebug() << m_engine << state());
if (isMasterEngine() && m_runControl) if (isMasterEngine() && m_runTool)
m_runControl->debuggingFinished(); m_runTool->debuggingFinished();
} }
void DebuggerEnginePrivate::setRemoteSetupState(RemoteSetupState state) void DebuggerEnginePrivate::setRemoteSetupState(RemoteSetupState state)
@@ -1521,9 +1525,9 @@ DebuggerRunControl *DebuggerEngine::runControl() const
DebuggerRunTool *DebuggerEngine::runTool() const DebuggerRunTool *DebuggerEngine::runTool() const
{ {
if (DebuggerRunControl *rc = d->runControl()) // if (DebuggerRunControl *rc = d->runControl())
return qobject_cast<DebuggerRunTool *>(rc->toolRunner()); // return qobject_cast<DebuggerRunTool *>(rc->toolRunner());
return nullptr; return d->m_runTool;
} }
Terminal *DebuggerEngine::terminal() const Terminal *DebuggerEngine::terminal() const

View File

@@ -200,7 +200,9 @@ public:
const DebuggerRunParameters &runParameters() const; const DebuggerRunParameters &runParameters() const;
DebuggerRunParameters &runParameters(); DebuggerRunParameters &runParameters();
void setRunTool(DebuggerRunTool *runTool);
DebuggerRunTool *runTool() const; DebuggerRunTool *runTool() const;
void startDebugger();
enum { enum {
// Remove need to qualify each use. // Remove need to qualify each use.
@@ -224,7 +226,6 @@ public:
void updateWatchData(const QString &iname); // FIXME: Merge with above. void updateWatchData(const QString &iname); // FIXME: Merge with above.
virtual void selectWatchData(const QString &iname); virtual void selectWatchData(const QString &iname);
virtual void startDebugger(DebuggerRunControl *runControl);
virtual void prepareForRestart() {} virtual void prepareForRestart() {}
virtual void watchPoint(const QPoint &pnt); virtual void watchPoint(const QPoint &pnt);

View File

@@ -81,8 +81,6 @@ DebuggerEngine *createQmlEngine(const DebuggerRunParameters &rp);
DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &rp, QStringList *error); DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &rp, QStringList *error);
DebuggerEngine *createLldbEngine(const DebuggerRunParameters &rp); DebuggerEngine *createLldbEngine(const DebuggerRunParameters &rp);
static DebuggerEngine *engine(const DebuggerRunControl *runControl);
} // namespace Internal } // namespace Internal
@@ -134,13 +132,18 @@ DebuggerRunControl::~DebuggerRunControl()
} }
void DebuggerRunControl::start() void DebuggerRunControl::start()
{
toolRunner()->startIt();
}
void DebuggerRunTool::startIt()
{ {
Debugger::Internal::saveModeToRestore(); Debugger::Internal::saveModeToRestore();
Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId); Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO); TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
DebuggerEngine *engine = Internal::engine(this); DebuggerEngine *engine = m_engine;
QTC_ASSERT(engine, return); QTC_ASSERT(engine, return);
const DebuggerRunParameters &rp = engine->runParameters(); const DebuggerRunParameters &rp = engine->runParameters();
// User canceled input dialog asking for executable when working on library project. // User canceled input dialog asking for executable when working on library project.
@@ -148,8 +151,8 @@ void DebuggerRunControl::start()
&& rp.inferior.executable.isEmpty() && rp.inferior.executable.isEmpty()
&& rp.interpreter.isEmpty()) { && rp.interpreter.isEmpty()) {
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat); appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat);
reportApplicationStart(); runControl()->reportApplicationStart();
reportApplicationStop(); runControl()->reportApplicationStop();
return; return;
} }
@@ -182,75 +185,74 @@ void DebuggerRunControl::start()
// We might get a synchronous startFailed() notification on Windows, // We might get a synchronous startFailed() notification on Windows,
// when launching the process fails. Emit a proper finished() sequence. // when launching the process fails. Emit a proper finished() sequence.
reportApplicationStart(); runControl()->reportApplicationStart();
engine->startDebugger(this); engine->startDebugger();
if (isRunning()) if (runControl()->isRunning())
appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat); appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat);
} }
void DebuggerRunControl::startFailed() void DebuggerRunTool::startFailed()
{ {
appendMessage(tr("Debugging has failed") + QLatin1Char('\n'), NormalMessageFormat); appendMessage(tr("Debugging has failed") + QLatin1Char('\n'), NormalMessageFormat);
engine(this)->handleStartFailed(); m_engine->handleStartFailed();
} }
void DebuggerRunControl::notifyEngineRemoteServerRunning(const QByteArray &msg, int pid) void DebuggerRunTool::notifyEngineRemoteServerRunning(const QByteArray &msg, int pid)
{ {
engine(this)->notifyEngineRemoteServerRunning(QString::fromUtf8(msg), pid); m_engine->notifyEngineRemoteServerRunning(QString::fromUtf8(msg), pid);
} }
void DebuggerRunControl::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) void DebuggerRunTool::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result)
{ {
engine(this)->notifyEngineRemoteSetupFinished(result); m_engine->notifyEngineRemoteSetupFinished(result);
} }
void DebuggerRunControl::stop() void DebuggerRunControl::stop()
{ {
QTC_ASSERT(engine(this), return); m_debuggerTool->stopIt();
engine(this)->quitDebugger();
} }
void DebuggerRunControl::debuggingFinished() void DebuggerRunTool::stopIt()
{ {
reportApplicationStop(); m_engine->quitDebugger();
} }
void DebuggerRunControl::showMessage(const QString &msg, int channel) DebuggerRunTool *DebuggerRunControl::toolRunner() const
{ {
QTC_ASSERT(engine(this), return); // return qobject_cast<DebuggerRunTool *>(RunControl::toolRunner());
QTC_ASSERT(engine(this)->runTool(), return); return m_debuggerTool;
engine(this)->runTool()->showMessage(msg, channel);
} }
DebuggerStartParameters &DebuggerRunControl::startParameters() void DebuggerRunTool::debuggingFinished()
{ {
return engine(this)->runParameters(); runControl()->reportApplicationStop();
} }
void DebuggerRunControl::notifyInferiorIll() DebuggerStartParameters &DebuggerRunTool::startParameters()
{ {
QTC_ASSERT(engine(this), return); return m_engine->runParameters();
engine(this)->notifyInferiorIll();
} }
void DebuggerRunControl::notifyInferiorExited() void DebuggerRunTool::notifyInferiorIll()
{ {
QTC_ASSERT(engine(this), return); m_engine->notifyInferiorIll();
engine(this)->notifyInferiorExited();
} }
void DebuggerRunControl::quitDebugger() void DebuggerRunTool::notifyInferiorExited()
{ {
QTC_ASSERT(engine(this), return); m_engine->notifyInferiorExited();
engine(this)->quitDebugger();
} }
void DebuggerRunControl::abortDebugger() void DebuggerRunTool::quitDebugger()
{ {
QTC_ASSERT(engine(this), return); m_engine->quitDebugger();
engine(this)->abortDebugger(); }
void DebuggerRunTool::abortDebugger()
{
m_engine->abortDebugger();
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@@ -517,6 +519,7 @@ 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);
@@ -533,7 +536,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerRunParame
} }
} }
qobject_cast<DebuggerRunControl *>(runControl)->m_engine = m_engine; m_engine->setRunTool(this);
connect(runControl, &RunControl::finished, connect(runControl, &RunControl::finished,
this, &DebuggerRunTool::handleFinished); this, &DebuggerRunTool::handleFinished);
@@ -592,14 +595,6 @@ void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout)
namespace Internal { namespace Internal {
DebuggerEngine *engine(const DebuggerRunControl *runControl)
{
QTC_ASSERT(runControl, return nullptr);
//return qobject_cast<DebuggerRunTool *>(runControl->toolRunner())->engine();
return runControl->m_engine;
}
/// DebuggerRunControlFactory /// DebuggerRunControlFactory
class DebuggerRunControlFactory : public IRunControlFactory class DebuggerRunControlFactory : public IRunControlFactory

View File

@@ -58,10 +58,24 @@ public:
Internal::DebuggerEngine *engine() const { return m_engine; } Internal::DebuggerEngine *engine() const { return m_engine; }
DebuggerRunControl *runControl() const; DebuggerRunControl *runControl() const;
void showMessage(const QString &msg, int channel, int timeout = -1); void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1);
void startIt();
void stopIt();
void handleFinished(); void handleFinished();
void startFailed();
void notifyEngineRemoteServerRunning(const QByteArray &msg, int pid);
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result);
void notifyInferiorIll();
Q_SLOT void notifyInferiorExited();
void quitDebugger();
void abortDebugger();
void debuggingFinished();
DebuggerStartParameters &startParameters(); // Used in Boot2Qt.
private: private:
Internal::DebuggerEngine *m_engine = nullptr; // Master engine Internal::DebuggerEngine *m_engine = nullptr; // Master engine
QStringList m_errors; QStringList m_errors;
@@ -75,22 +89,10 @@ public:
DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode); DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode);
~DebuggerRunControl() override; ~DebuggerRunControl() override;
// ProjectExplorer::RunControl
void start() override; void start() override;
void stop() override; // Called from SnapshotWindow. void stop() override; // Called from SnapshotWindow.
void startFailed(); DebuggerRunTool *toolRunner() const;
void notifyEngineRemoteServerRunning(const QByteArray &msg, int pid);
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result);
void notifyInferiorIll();
Q_SLOT void notifyInferiorExited();
void quitDebugger();
void abortDebugger();
void debuggingFinished();
void showMessage(const QString &msg, int channel = LogDebug);
DebuggerStartParameters &startParameters(); // Used in Boot2Qt.
signals: signals:
void requestRemoteSetup(); void requestRemoteSetup();
@@ -98,7 +100,7 @@ signals:
void stateChanged(Debugger::DebuggerState state); void stateChanged(Debugger::DebuggerState state);
public: public:
Internal::DebuggerEngine *m_engine = nullptr; // FIXME: Remove. DebuggerRunTool *m_debuggerTool = nullptr;
}; };
} // namespace Debugger } // namespace Debugger

View File

@@ -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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd) void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
@@ -213,17 +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()->abortDebugger(); runControl()->toolRunner()->abortDebugger();
} }
void IosDebugSupport::handleRemoteOutput(const QString &output) void IosDebugSupport::handleRemoteOutput(const QString &output)
{ {
runControl()->showMessage(output, AppOutput); runControl()->toolRunner()->showMessage(output, AppOutput);
} }
void IosDebugSupport::handleRemoteErrorOutput(const QString &output) void IosDebugSupport::handleRemoteErrorOutput(const QString &output)
{ {
runControl()->showMessage(output, AppError); runControl()->toolRunner()->showMessage(output, AppError);
} }
DebuggerRunControl *IosDebugSupport::runControl() DebuggerRunControl *IosDebugSupport::runControl()

View File

@@ -415,6 +415,17 @@ public:
virtual void notifyRemoteSetupFailed(const QString &) {} // Same. virtual void notifyRemoteSetupFailed(const QString &) {} // Same.
virtual void notifyRemoteFinished() {} // Same. virtual void notifyRemoteFinished() {} // Same.
void reportApplicationStart(); // Call this when the application starts to run
void reportApplicationStop(); // Call this when the application has stopped for any reason
bool showPromptToStopDialog(const QString &title, const QString &text,
const QString &stopButtonText = QString(),
const QString &cancelButtonText = QString(),
bool *prompt = nullptr) const;
virtual void start();
virtual void stop();
signals: signals:
void appendMessageRequested(ProjectExplorer::RunControl *runControl, void appendMessageRequested(ProjectExplorer::RunControl *runControl,
const QString &msg, Utils::OutputFormat format); const QString &msg, Utils::OutputFormat format);
@@ -424,18 +435,6 @@ signals:
void finished(); // Use reportApplicationStop! void finished(); // Use reportApplicationStop!
void applicationProcessHandleChanged(QPrivateSignal); // Use setApplicationProcessHandle void applicationProcessHandleChanged(QPrivateSignal); // Use setApplicationProcessHandle
protected:
virtual void start();
virtual void stop();
void reportApplicationStart(); // Call this when the application starts to run
void reportApplicationStop(); // Call this when the application has stopped for any reason
bool showPromptToStopDialog(const QString &title, const QString &text,
const QString &stopButtonText = QString(),
const QString &cancelButtonText = QString(),
bool *prompt = nullptr) const;
private: private:
friend class Internal::RunControlPrivate; friend class Internal::RunControlPrivate;
friend class TargetRunner; friend class TargetRunner;

View File

@@ -159,19 +159,19 @@ void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState s
void QnxAttachDebugSupport::handleError(const QString &message) void QnxAttachDebugSupport::handleError(const QString &message)
{ {
if (m_runControl) if (m_runControl)
m_runControl->showMessage(message, Debugger::AppError); m_runControl->toolRunner()->showMessage(message, Debugger::AppError);
} }
void QnxAttachDebugSupport::handleProgressReport(const QString &message) void QnxAttachDebugSupport::handleProgressReport(const QString &message)
{ {
if (m_runControl) if (m_runControl)
m_runControl->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff); m_runControl->toolRunner()->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff);
} }
void QnxAttachDebugSupport::handleRemoteOutput(const QByteArray &output) void QnxAttachDebugSupport::handleRemoteOutput(const QByteArray &output)
{ {
if (m_runControl) if (m_runControl)
m_runControl->showMessage(QString::fromUtf8(output), Debugger::AppOutput); m_runControl->toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
} }
void QnxAttachDebugSupport::stopPDebug() void QnxAttachDebugSupport::stopPDebug()

View File

@@ -82,7 +82,7 @@ void QnxDebugSupport::handleAdapterSetupRequested()
{ {
QTC_ASSERT(state() == Inactive, return); QTC_ASSERT(state() == Inactive, return);
runControl()->showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Debugger::AppStuff); runControl()->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()->notifyEngineRemoteSetupFinished(result); runControl()->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()->notifyInferiorIll(); runControl()->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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
} }
@@ -166,38 +166,39 @@ void QnxDebugSupport::killInferiorProcess()
void QnxDebugSupport::handleProgressReport(const QString &progressOutput) void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
{ {
runControl()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff); runControl()->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()->showMessage(QString::fromUtf8(output), Debugger::AppOutput); runControl()->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()->showMessage(error, Debugger::AppError); runControl()->toolRunner()->showMessage(error, Debugger::AppError);
runControl()->notifyInferiorIll(); runControl()->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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
} }
void QnxDebugSupport::printMissingWarning() void QnxDebugSupport::printMissingWarning()
{ {
runControl()->showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available."), Debugger::AppError); runControl()->toolRunner()->showMessage(tr("Warning: \"slog2info\" is not found "
"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()->showMessage(msg, Debugger::AppOutput); runControl()->toolRunner()->showMessage(msg, Debugger::AppOutput);
} }
Debugger::DebuggerRunControl *QnxDebugSupport::runControl() Debugger::DebuggerRunControl *QnxDebugSupport::runControl()

View File

@@ -101,7 +101,7 @@ bool LinuxDeviceDebugSupport::isQmlDebugging() const
void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel) void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
{ {
if (state() != Inactive) if (state() != Inactive)
runControl()->showMessage(msg, channel); runControl()->toolRunner()->showMessage(msg, channel);
} }
DebuggerRunControl *LinuxDeviceDebugSupport::runControl() const DebuggerRunControl *LinuxDeviceDebugSupport::runControl() const
@@ -185,7 +185,7 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
{ {
if (state() == Running) { if (state() == Running) {
showMessage(error, AppError); showMessage(error, AppError);
runControl()->notifyInferiorIll(); runControl()->toolRunner()->notifyInferiorIll();
} else if (state() != Inactive) { } else if (state() != Inactive) {
handleAdapterSetupFailed(error); handleAdapterSetupFailed(error);
} }
@@ -199,15 +199,15 @@ void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success)
if (state() == Running) { if (state() == 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()->quitDebugger(); runControl()->toolRunner()->quitDebugger();
else if (!success) else if (!success)
runControl()->notifyInferiorIll(); runControl()->toolRunner()->notifyInferiorIll();
} else if (state() == StartingRunner) { } else if (state() == StartingRunner) {
RemoteSetupResult result; RemoteSetupResult result;
result.success = false; result.success = false;
result.reason = tr("Debugging failed."); result.reason = tr("Debugging failed.");
runControl()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
reset(); reset();
} }
@@ -251,7 +251,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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
void LinuxDeviceDebugSupport::handleAdapterSetupDone() void LinuxDeviceDebugSupport::handleAdapterSetupDone()
@@ -262,7 +262,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()->notifyEngineRemoteSetupFinished(result); runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
} }
void LinuxDeviceDebugSupport::handleRemoteProcessStarted() void LinuxDeviceDebugSupport::handleRemoteProcessStarted()

View File

@@ -148,7 +148,7 @@ bool WinRtRunnerHelper::waitForStarted(int msecs)
void WinRtRunnerHelper::setDebugRunControl(Debugger::DebuggerRunControl *runControl) void WinRtRunnerHelper::setDebugRunControl(Debugger::DebuggerRunControl *runControl)
{ {
m_debugMessenger = runControl; m_debugMessenger = runControl->toolRunner();
m_messenger = runControl; m_messenger = runControl;
} }

View File

@@ -36,7 +36,11 @@
namespace Utils { class QtcProcess; } namespace Utils { class QtcProcess; }
namespace ProjectExplorer { class RunControl; } namespace ProjectExplorer { class RunControl; }
namespace Debugger { class DebuggerRunControl; }
namespace Debugger {
class DebuggerRunControl;
class DebuggerRunTool;
}
namespace WinRt { namespace WinRt {
namespace Internal { namespace Internal {
@@ -76,7 +80,7 @@ private:
void appendMessage(const QString &message, Utils::OutputFormat format); void appendMessage(const QString &message, Utils::OutputFormat format);
ProjectExplorer::RunControl *m_messenger; ProjectExplorer::RunControl *m_messenger;
Debugger::DebuggerRunControl *m_debugMessenger; Debugger::DebuggerRunTool *m_debugMessenger;
WinRtRunConfiguration *m_runConfiguration; WinRtRunConfiguration *m_runConfiguration;
WinRtDevice::ConstPtr m_device; WinRtDevice::ConstPtr m_device;
Utils::Environment m_environment; Utils::Environment m_environment;