debugger: remove inferiorStarted() signal.

It had unclear semantics and was only used to show a statusmessage.
We do that directly now.
This commit is contained in:
hjk
2009-09-29 10:15:52 +02:00
parent f685aa2361
commit 10fa3b2b76
9 changed files with 24 additions and 33 deletions

View File

@@ -73,22 +73,22 @@ enum DebuggerState
InferiorPrepared, InferiorPrepared,
InferiorPreparationFailed, InferiorPreparationFailed,
InferiorStarting, InferiorStarting,
// InferiorStarted, // That's either InferiorRunningRequested or InferiorStopped // InferiorStarted, // Use InferiorRunningRequested or InferiorStopped
InferiorStartFailed, InferiorStartFailed,
InferiorRunningRequested, // Debuggee requested to run InferiorRunningRequested, // Debuggee requested to run
InferiorRunning, // Debuggee running InferiorRunning, // Debuggee running
InferiorStopping, // Debuggee running, stop requested InferiorStopping, // Debuggee running, stop requested
InferiorStopped, // Debuggee stopped InferiorStopped, // Debuggee stopped
InferiorStopFailed, // Debuggee stopped InferiorStopFailed, // Debuggee stopped
InferiorShuttingDown, InferiorShuttingDown,
InferiorShutDown, InferiorShutDown,
InferiorShutdownFailed, InferiorShutdownFailed,
AdapterShuttingDown, AdapterShuttingDown,
//AdapterShutDown, // use DebuggerNotReady //AdapterShutDown, // Use DebuggerNotReady instead
AdapterShutdownFailed, AdapterShutdownFailed,
}; };
@@ -106,12 +106,12 @@ enum DebuggerStartMode
enum LogChannel enum LogChannel
{ {
LogInput, // Used for user input LogInput, // Used for user input
LogOutput, LogOutput,
LogWarning, LogWarning,
LogError, LogError,
LogStatus, // Used for status changed messages LogStatus, // Used for status changed messages
LogTime, // Used for time stamp messages LogTime, // Used for time stamp messages
LogDebug, LogDebug,
LogMisc LogMisc
}; };

View File

@@ -76,7 +76,6 @@ signals:
void inferiorPrepared(); void inferiorPrepared();
void inferiorPreparationFailed(const QString &msg); void inferiorPreparationFailed(const QString &msg);
void inferiorStarted();
void inferiorStartFailed(const QString &msg); void inferiorStartFailed(const QString &msg);
void inferiorShutDown(); void inferiorShutDown();
void inferiorShutdownFailed(const QString &msg); void inferiorShutdownFailed(const QString &msg);
@@ -95,6 +94,8 @@ protected:
{ return m_engine->startParameters(); } { return m_engine->startParameters(); }
void debugMessage(const QString &msg) const void debugMessage(const QString &msg) const
{ m_engine->debugMessage(msg); } { m_engine->debugMessage(msg); }
void showStatusMessage(const QString &msg) const
{ m_engine->showStatusMessage(msg); }
GdbEngine * const m_engine; GdbEngine * const m_engine;
}; };

View File

@@ -134,13 +134,14 @@ void AttachGdbAdapter::handleAttach(const GdbResponse &response)
void AttachGdbAdapter::startInferior() void AttachGdbAdapter::startInferior()
{ {
QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
#if 0 #if 1
setState(InferiorStopped);
debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Attached to stopped inferior."));
#else
// continue on attach // continue on attach
setState(InferiorRunningRequested); setState(InferiorRunningRequested);
m_engine->postCommand(_("-exec-continue"), CB(handleContinue)); m_engine->postCommand(_("-exec-continue"), CB(handleContinue));
#else
setState(InferiorStopped);
emit inferiorStarted();
#endif #endif
} }
@@ -149,7 +150,8 @@ void AttachGdbAdapter::handleContinue(const GdbResponse &response)
QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
setState(InferiorRunning); setState(InferiorRunning);
emit inferiorStarted(); debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Inferior running."));
} else { } else {
QTC_ASSERT(response.resultClass == GdbResultError, /**/); QTC_ASSERT(response.resultClass == GdbResultError, /**/);
const QByteArray &msg = response.data.findChild("msg").data(); const QByteArray &msg = response.data.findChild("msg").data();

View File

@@ -151,7 +151,8 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
setState(InferiorStopped); setState(InferiorStopped);
emit inferiorStarted(); debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Attached to core."));
m_engine->updateAll(); m_engine->updateAll();
} else { } else {
QTC_ASSERT(response.resultClass == GdbResultError, /**/); QTC_ASSERT(response.resultClass == GdbResultError, /**/);

View File

@@ -268,8 +268,6 @@ void GdbEngine::connectAdapter()
connect(m_gdbAdapter, SIGNAL(inferiorPreparationFailed(QString)), connect(m_gdbAdapter, SIGNAL(inferiorPreparationFailed(QString)),
this, SLOT(handleInferiorPreparationFailed(QString))); this, SLOT(handleInferiorPreparationFailed(QString)));
connect(m_gdbAdapter, SIGNAL(inferiorStarted()),
this, SLOT(handleInferiorStarted()));
connect(m_gdbAdapter, SIGNAL(inferiorStartFailed(QString)), connect(m_gdbAdapter, SIGNAL(inferiorStartFailed(QString)),
this, SLOT(handleInferiorStartFailed(QString))); this, SLOT(handleInferiorStartFailed(QString)));
connect(m_gdbAdapter, SIGNAL(inferiorShutDown()), connect(m_gdbAdapter, SIGNAL(inferiorShutDown()),
@@ -4163,17 +4161,6 @@ void GdbEngine::handleInferiorStartFailed(const QString &msg)
shutdown(); shutdown();
} }
void GdbEngine::handleInferiorStarted()
{
QTC_ASSERT(state() == InferiorRunning
|| state() == InferiorStopped, qDebug() << state());
debugMessage(_("INFERIOR STARTED"));
if (state() == InferiorStopped)
showStatusMessage(tr("Inferior stopped."));
else
showStatusMessage(tr("Inferior started."));
}
void GdbEngine::handleInferiorShutDown() void GdbEngine::handleInferiorShutDown()
{ {
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN")); debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));

View File

@@ -239,7 +239,6 @@ private slots:
void handleInferiorPrepared(); void handleInferiorPrepared();
void handleInferiorPreparationFailed(const QString &msg); void handleInferiorPreparationFailed(const QString &msg);
void handleInferiorStarted();
void handleInferiorStartFailed(const QString &msg); void handleInferiorStartFailed(const QString &msg);
void handleInferiorShutDown(); void handleInferiorShutDown();
void handleInferiorShutdownFailed(const QString &msg); void handleInferiorShutdownFailed(const QString &msg);

View File

@@ -211,7 +211,8 @@ void PlainGdbAdapter::handleExecRun(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
QTC_ASSERT(state() == InferiorRunning, qDebug() << state()); QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
emit inferiorStarted(); debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Inferior started."));
} else { } else {
QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state());
QTC_ASSERT(response.resultClass == GdbResultError, /**/); QTC_ASSERT(response.resultClass == GdbResultError, /**/);

View File

@@ -251,7 +251,8 @@ void RemoteGdbAdapter::handleFirstContinue(const GdbResponse &record)
QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state());
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
setState(InferiorStopped); setState(InferiorStopped);
emit inferiorStarted(); debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Attached to stopped inferior."));
} else if (record.resultClass == GdbResultError) { } else if (record.resultClass == GdbResultError) {
//QString msg = __(record.data.findChild("msg").data()); //QString msg = __(record.data.findChild("msg").data());
QString msg1 = tr("Connecting to remote server failed:\n"); QString msg1 = tr("Connecting to remote server failed:\n");

View File

@@ -1463,15 +1463,14 @@ void TrkGdbAdapter::startInferior()
QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
setState(InferiorRunningRequested); setState(InferiorRunningRequested);
m_engine->postCommand(_("-exec-continue"), CB(handleFirstContinue)); m_engine->postCommand(_("-exec-continue"), CB(handleFirstContinue));
// FIXME: Is there a way to properly recognize a successful start?
emit inferiorStarted();
} }
void TrkGdbAdapter::handleFirstContinue(const GdbResponse &record) void TrkGdbAdapter::handleFirstContinue(const GdbResponse &record)
{ {
QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state());
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
// inferiorStarted already emitted above, see FIXME debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Inferior running."));
} else if (record.resultClass == GdbResultError) { } else if (record.resultClass == GdbResultError) {
//QString msg = __(record.data.findChild("msg").data()); //QString msg = __(record.data.findChild("msg").data());
QString msg1 = tr("Connecting to remote server failed:"); QString msg1 = tr("Connecting to remote server failed:");