forked from qt-creator/qt-creator
ProjectExplorer: Fix debugger shut down
Change-Id: Ic74470aedc6d5b9d70858e21a73df1bcdb48ac49 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -153,14 +153,14 @@ void DebuggerRunTool::start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat);
|
appendMessage(tr("Debugging starts"), NormalMessageFormat);
|
||||||
Internal::runControlStarted(this);
|
Internal::runControlStarted(this);
|
||||||
engine->start();
|
engine->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunTool::startFailed()
|
void DebuggerRunTool::startFailed()
|
||||||
{
|
{
|
||||||
appendMessage(tr("Debugging has failed") + QLatin1Char('\n'), NormalMessageFormat);
|
appendMessage(tr("Debugging has failed"), NormalMessageFormat);
|
||||||
m_engine->handleStartFailed();
|
m_engine->handleStartFailed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +192,8 @@ void DebuggerRunTool::onTargetFailure()
|
|||||||
|
|
||||||
void DebuggerRunTool::debuggingFinished()
|
void DebuggerRunTool::debuggingFinished()
|
||||||
{
|
{
|
||||||
Internal::runControlFinished(this);
|
|
||||||
appendMessage(tr("Debugging has finished"), NormalMessageFormat);
|
appendMessage(tr("Debugging has finished"), NormalMessageFormat);
|
||||||
|
Internal::runControlFinished(this);
|
||||||
reportStopped();
|
reportStopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -515,20 +515,20 @@ enum class RunWorkerState
|
|||||||
Initialized, Starting, Running, Stopping, Done, Failed
|
Initialized, Starting, Running, Stopping, Done, Failed
|
||||||
};
|
};
|
||||||
|
|
||||||
//static QString stateName(RunWorkerState s)
|
static QString stateName(RunWorkerState s)
|
||||||
//{
|
{
|
||||||
//# define SN(x) case x: return QLatin1String(#x);
|
# define SN(x) case x: return QLatin1String(#x);
|
||||||
// switch (s) {
|
switch (s) {
|
||||||
// SN(RunWorkerState::Initialized)
|
SN(RunWorkerState::Initialized)
|
||||||
// SN(RunWorkerState::Starting)
|
SN(RunWorkerState::Starting)
|
||||||
// SN(RunWorkerState::Running)
|
SN(RunWorkerState::Running)
|
||||||
// SN(RunWorkerState::Stopping)
|
SN(RunWorkerState::Stopping)
|
||||||
// SN(RunWorkerState::Done)
|
SN(RunWorkerState::Done)
|
||||||
// SN(RunWorkerState::Failed)
|
SN(RunWorkerState::Failed)
|
||||||
// }
|
}
|
||||||
// return QLatin1String("<unknown>");
|
return QLatin1String("<unknown>");
|
||||||
//# undef SN
|
# undef SN
|
||||||
//}
|
}
|
||||||
|
|
||||||
class RunWorkerPrivate : public QObject
|
class RunWorkerPrivate : public QObject
|
||||||
{
|
{
|
||||||
@@ -864,7 +864,22 @@ void RunControlPrivate::onWorkerFailed(RunWorker *worker, const QString &msg)
|
|||||||
|
|
||||||
void RunControlPrivate::onWorkerStopped(RunWorker *worker)
|
void RunControlPrivate::onWorkerStopped(RunWorker *worker)
|
||||||
{
|
{
|
||||||
debugMessage(worker->displayName() + " stopped.");
|
switch (worker->d->state) {
|
||||||
|
case RunWorkerState::Running:
|
||||||
|
// That was a spontaneous stop.
|
||||||
|
worker->d->state = RunWorkerState::Done;
|
||||||
|
debugMessage(worker->displayName() + " stopped spontaneously.");
|
||||||
|
break;
|
||||||
|
case RunWorkerState::Stopping:
|
||||||
|
worker->d->state = RunWorkerState::Done;
|
||||||
|
debugMessage(worker->displayName() + " stopped expectedly.");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
debugMessage(worker->displayName() + " stopped unexpectedly in state"
|
||||||
|
+ stateName(worker->d->state));
|
||||||
|
worker->d->state = RunWorkerState::Failed;
|
||||||
|
break;
|
||||||
|
}
|
||||||
continueStop();
|
continueStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1206,6 +1221,8 @@ void SimpleTargetRunner::start()
|
|||||||
this, &SimpleTargetRunner::onProcessStarted);
|
this, &SimpleTargetRunner::onProcessStarted);
|
||||||
connect(&m_launcher, &ApplicationLauncher::processExited,
|
connect(&m_launcher, &ApplicationLauncher::processExited,
|
||||||
this, &SimpleTargetRunner::onProcessFinished);
|
this, &SimpleTargetRunner::onProcessFinished);
|
||||||
|
connect(&m_launcher, &ApplicationLauncher::error,
|
||||||
|
this, &SimpleTargetRunner::onProcessError);
|
||||||
|
|
||||||
QTC_ASSERT(r.is<StandardRunnable>(), return);
|
QTC_ASSERT(r.is<StandardRunnable>(), return);
|
||||||
const QString executable = r.as<StandardRunnable>().executable;
|
const QString executable = r.as<StandardRunnable>().executable;
|
||||||
@@ -1291,6 +1308,13 @@ void SimpleTargetRunner::onProcessFinished(int exitCode, QProcess::ExitStatus st
|
|||||||
reportStopped();
|
reportStopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SimpleTargetRunner::onProcessError(QProcess::ProcessError)
|
||||||
|
{
|
||||||
|
QString msg = tr("%1 finished.");
|
||||||
|
appendMessage(msg.arg(runnable().displayName()), Utils::NormalMessageFormat);
|
||||||
|
reportStopped();
|
||||||
|
}
|
||||||
|
|
||||||
void RunControl::reportFailure(const QString &msg)
|
void RunControl::reportFailure(const QString &msg)
|
||||||
{
|
{
|
||||||
d->showError(msg);
|
d->showError(msg);
|
||||||
|
|||||||
@@ -535,6 +535,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void onProcessStarted();
|
void onProcessStarted();
|
||||||
void onProcessFinished(int exitCode, QProcess::ExitStatus status);
|
void onProcessFinished(int exitCode, QProcess::ExitStatus status);
|
||||||
|
void onProcessError(QProcess::ProcessError error);
|
||||||
|
|
||||||
ApplicationLauncher m_launcher;
|
ApplicationLauncher m_launcher;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user