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,
[this](const QByteArray &serverChannel, int pid) {
this->runControl()->notifyEngineRemoteServerRunning(serverChannel, pid);
this->runControl()->toolRunner()->notifyEngineRemoteServerRunning(serverChannel, pid);
});
connect(m_runner, &AndroidRunner::remoteProcessStarted,
@@ -173,12 +173,12 @@ AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl)
connect(m_runner, &AndroidRunner::remoteErrorOutput,
[this](const QString &output) {
this->runControl()->showMessage(output, AppError);
this->runControl()->toolRunner()->showMessage(output, AppError);
});
connect(m_runner, &AndroidRunner::remoteOutput,
[this](const QString &output) {
this->runControl()->showMessage(output, AppOutput);
this->runControl()->toolRunner()->showMessage(output, AppOutput);
});
QTC_ASSERT(runControl, return);
@@ -200,7 +200,7 @@ void AndroidDebugSupport::handleRemoteProcessStarted(Utils::Port gdbServerPort,
result.success = true;
result.gdbServerPort = gdbServerPort;
result.qmlServerPort = qmlPort;
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
DebuggerRunControl *AndroidDebugSupport::runControl()

View File

@@ -96,12 +96,12 @@ void BareMetalDebugSupport::appRunnerFinished(bool success)
if (m_state == Running) {
if (!success)
runControl()->notifyInferiorIll();
runControl()->toolRunner()->notifyInferiorIll();
} else if (m_state == StartingRunner) {
Debugger::RemoteSetupResult result;
result.success = false;
result.reason = tr("Debugging failed.");
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
reset();
@@ -116,7 +116,7 @@ void BareMetalDebugSupport::appRunnerError(const QString &error)
{
if (m_state == Running) {
showMessage(error, Debugger::AppError);
runControl()->notifyInferiorIll();
runControl()->toolRunner()->notifyInferiorIll();
} else if (m_state != Inactive) {
adapterSetupFailed(error);
}
@@ -127,7 +127,7 @@ void BareMetalDebugSupport::adapterSetupDone()
m_state = Running;
Debugger::RemoteSetupResult result;
result.success = true;
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
@@ -137,7 +137,7 @@ void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
Debugger::RemoteSetupResult result;
result.success = false;
result.reason = tr("Initial setup failed: %1").arg(error);
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
void BareMetalDebugSupport::startExecution()
@@ -191,7 +191,7 @@ void BareMetalDebugSupport::reset()
void BareMetalDebugSupport::showMessage(const QString &msg, int channel)
{
if (m_state != Inactive)
runControl()->showMessage(msg, channel);
runControl()->toolRunner()->showMessage(msg, channel);
}
Debugger::DebuggerRunControl *BareMetalDebugSupport::runControl()

View File

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

View File

@@ -200,7 +200,9 @@ public:
const DebuggerRunParameters &runParameters() const;
DebuggerRunParameters &runParameters();
void setRunTool(DebuggerRunTool *runTool);
DebuggerRunTool *runTool() const;
void startDebugger();
enum {
// Remove need to qualify each use.
@@ -224,7 +226,6 @@ public:
void updateWatchData(const QString &iname); // FIXME: Merge with above.
virtual void selectWatchData(const QString &iname);
virtual void startDebugger(DebuggerRunControl *runControl);
virtual void prepareForRestart() {}
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 *createLldbEngine(const DebuggerRunParameters &rp);
static DebuggerEngine *engine(const DebuggerRunControl *runControl);
} // namespace Internal
@@ -134,13 +132,18 @@ DebuggerRunControl::~DebuggerRunControl()
}
void DebuggerRunControl::start()
{
toolRunner()->startIt();
}
void DebuggerRunTool::startIt()
{
Debugger::Internal::saveModeToRestore();
Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
DebuggerEngine *engine = Internal::engine(this);
DebuggerEngine *engine = m_engine;
QTC_ASSERT(engine, return);
const DebuggerRunParameters &rp = engine->runParameters();
// User canceled input dialog asking for executable when working on library project.
@@ -148,8 +151,8 @@ void DebuggerRunControl::start()
&& rp.inferior.executable.isEmpty()
&& rp.interpreter.isEmpty()) {
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat);
reportApplicationStart();
reportApplicationStop();
runControl()->reportApplicationStart();
runControl()->reportApplicationStop();
return;
}
@@ -182,75 +185,74 @@ void DebuggerRunControl::start()
// We might get a synchronous startFailed() notification on Windows,
// 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);
}
void DebuggerRunControl::startFailed()
void DebuggerRunTool::startFailed()
{
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()
{
QTC_ASSERT(engine(this), return);
engine(this)->quitDebugger();
m_debuggerTool->stopIt();
}
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);
QTC_ASSERT(engine(this)->runTool(), return);
engine(this)->runTool()->showMessage(msg, channel);
// return qobject_cast<DebuggerRunTool *>(RunControl::toolRunner());
return m_debuggerTool;
}
DebuggerStartParameters &DebuggerRunControl::startParameters()
void DebuggerRunTool::debuggingFinished()
{
return engine(this)->runParameters();
runControl()->reportApplicationStop();
}
void DebuggerRunControl::notifyInferiorIll()
DebuggerStartParameters &DebuggerRunTool::startParameters()
{
QTC_ASSERT(engine(this), return);
engine(this)->notifyInferiorIll();
return m_engine->runParameters();
}
void DebuggerRunControl::notifyInferiorExited()
void DebuggerRunTool::notifyInferiorIll()
{
QTC_ASSERT(engine(this), return);
engine(this)->notifyInferiorExited();
m_engine->notifyInferiorIll();
}
void DebuggerRunControl::quitDebugger()
void DebuggerRunTool::notifyInferiorExited()
{
QTC_ASSERT(engine(this), return);
engine(this)->quitDebugger();
m_engine->notifyInferiorExited();
}
void DebuggerRunControl::abortDebugger()
void DebuggerRunTool::quitDebugger()
{
QTC_ASSERT(engine(this), return);
engine(this)->abortDebugger();
m_engine->quitDebugger();
}
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)
: ToolRunner(runControl)
{
this->runControl()->m_debuggerTool = this; // FIXME: Remove.
DebuggerRunParameters m_rp = rp;
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,
this, &DebuggerRunTool::handleFinished);
@@ -592,14 +595,6 @@ void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout)
namespace Internal {
DebuggerEngine *engine(const DebuggerRunControl *runControl)
{
QTC_ASSERT(runControl, return nullptr);
//return qobject_cast<DebuggerRunTool *>(runControl->toolRunner())->engine();
return runControl->m_engine;
}
/// DebuggerRunControlFactory
class DebuggerRunControlFactory : public IRunControlFactory

View File

@@ -58,10 +58,24 @@ public:
Internal::DebuggerEngine *engine() const { return m_engine; }
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 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:
Internal::DebuggerEngine *m_engine = nullptr; // Master engine
QStringList m_errors;
@@ -75,22 +89,10 @@ public:
DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode);
~DebuggerRunControl() override;
// ProjectExplorer::RunControl
void start() override;
void stop() override; // Called from SnapshotWindow.
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();
void showMessage(const QString &msg, int channel = LogDebug);
DebuggerStartParameters &startParameters(); // Used in Boot2Qt.
DebuggerRunTool *toolRunner() const;
signals:
void requestRemoteSetup();
@@ -98,7 +100,7 @@ signals:
void stateChanged(Debugger::DebuggerState state);
public:
Internal::DebuggerEngine *m_engine = nullptr; // FIXME: Remove.
DebuggerRunTool *m_debuggerTool = nullptr;
};
} // namespace Debugger

View File

@@ -193,7 +193,7 @@ void IosDebugSupport::handleServerPorts(Utils::Port gdbServerPort, Utils::Port q
|| (m_runner && !m_runner->cppDebug() && qmlPort.isValid());
if (!result.success)
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)
@@ -204,7 +204,7 @@ void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort)
result.success = pid > 0;
if (!result.success)
result.reason = tr("Got an invalid process id.");
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
@@ -213,17 +213,17 @@ void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
appendMessage(tr("Run ended with error."), Utils::DebugFormat);
else
appendMessage(tr("Run ended."), Utils::DebugFormat);
runControl()->abortDebugger();
runControl()->toolRunner()->abortDebugger();
}
void IosDebugSupport::handleRemoteOutput(const QString &output)
{
runControl()->showMessage(output, AppOutput);
runControl()->toolRunner()->showMessage(output, AppOutput);
}
void IosDebugSupport::handleRemoteErrorOutput(const QString &output)
{
runControl()->showMessage(output, AppError);
runControl()->toolRunner()->showMessage(output, AppError);
}
DebuggerRunControl *IosDebugSupport::runControl()

View File

@@ -415,6 +415,17 @@ public:
virtual void notifyRemoteSetupFailed(const QString &) {} // 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:
void appendMessageRequested(ProjectExplorer::RunControl *runControl,
const QString &msg, Utils::OutputFormat format);
@@ -424,18 +435,6 @@ signals:
void finished(); // Use reportApplicationStop!
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:
friend class Internal::RunControlPrivate;
friend class TargetRunner;

View File

@@ -159,19 +159,19 @@ void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState s
void QnxAttachDebugSupport::handleError(const QString &message)
{
if (m_runControl)
m_runControl->showMessage(message, Debugger::AppError);
m_runControl->toolRunner()->showMessage(message, Debugger::AppError);
}
void QnxAttachDebugSupport::handleProgressReport(const QString &message)
{
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)
{
if (m_runControl)
m_runControl->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
m_runControl->toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
}
void QnxAttachDebugSupport::stopPDebug()

View File

@@ -82,7 +82,7 @@ void QnxDebugSupport::handleAdapterSetupRequested()
{
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();
}
@@ -124,7 +124,7 @@ void QnxDebugSupport::handleRemoteProcessStarted()
result.success = true;
result.gdbServerPort = m_pdebugPort;
result.qmlServerPort = m_qmlPort;
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
void QnxDebugSupport::handleRemoteProcessFinished(bool success)
@@ -134,13 +134,13 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success)
if (state() == Running) {
if (!success)
runControl()->notifyInferiorIll();
runControl()->toolRunner()->notifyInferiorIll();
} else {
Debugger::RemoteSetupResult result;
result.success = false;
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)
{
runControl()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
runControl()->toolRunner()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
}
void QnxDebugSupport::handleRemoteOutput(const QByteArray &output)
{
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)
{
if (state() == Running) {
runControl()->showMessage(error, Debugger::AppError);
runControl()->notifyInferiorIll();
runControl()->toolRunner()->showMessage(error, Debugger::AppError);
runControl()->toolRunner()->notifyInferiorIll();
} else if (state() != Inactive) {
setFinished();
Debugger::RemoteSetupResult result;
result.success = false;
result.reason = tr("Initial setup failed: %1").arg(error);
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
}
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)
{
Q_UNUSED(outputFormat);
runControl()->showMessage(msg, Debugger::AppOutput);
runControl()->toolRunner()->showMessage(msg, Debugger::AppOutput);
}
Debugger::DebuggerRunControl *QnxDebugSupport::runControl()

View File

@@ -101,7 +101,7 @@ bool LinuxDeviceDebugSupport::isQmlDebugging() const
void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
{
if (state() != Inactive)
runControl()->showMessage(msg, channel);
runControl()->toolRunner()->showMessage(msg, channel);
}
DebuggerRunControl *LinuxDeviceDebugSupport::runControl() const
@@ -185,7 +185,7 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
{
if (state() == Running) {
showMessage(error, AppError);
runControl()->notifyInferiorIll();
runControl()->toolRunner()->notifyInferiorIll();
} else if (state() != Inactive) {
handleAdapterSetupFailed(error);
}
@@ -199,15 +199,15 @@ void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success)
if (state() == Running) {
// The QML engine does not realize on its own that the application has finished.
if (d->qmlDebugging && !d->cppDebugging)
runControl()->quitDebugger();
runControl()->toolRunner()->quitDebugger();
else if (!success)
runControl()->notifyInferiorIll();
runControl()->toolRunner()->notifyInferiorIll();
} else if (state() == StartingRunner) {
RemoteSetupResult result;
result.success = false;
result.reason = tr("Debugging failed.");
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
reset();
}
@@ -251,7 +251,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupFailed(const QString &error)
RemoteSetupResult result;
result.success = false;
result.reason = tr("Initial setup failed: %1").arg(error);
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
void LinuxDeviceDebugSupport::handleAdapterSetupDone()
@@ -262,7 +262,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupDone()
result.success = true;
result.gdbServerPort = d->gdbServerPort;
result.qmlServerPort = d->qmlPort;
runControl()->notifyEngineRemoteSetupFinished(result);
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
void LinuxDeviceDebugSupport::handleRemoteProcessStarted()

View File

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

View File

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