-gdb-exit has a special return code as well

This commit is contained in:
Oswald Buddenhagen
2009-10-13 17:13:19 +02:00
parent 98b477fc32
commit 70f696d056
7 changed files with 14 additions and 11 deletions

View File

@@ -130,7 +130,7 @@ void AttachGdbAdapter::shutdown()
case InferiorShutDown: case InferiorShutDown:
setState(AdapterShuttingDown); setState(AdapterShuttingDown);
m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); m_engine->postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleExit));
return; return;
default: default:

View File

@@ -192,7 +192,7 @@ void CoreGdbAdapter::shutdown()
case InferiorUnrunnable: case InferiorUnrunnable:
case InferiorShutDown: case InferiorShutDown:
setState(AdapterShuttingDown); setState(AdapterShuttingDown);
m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); m_engine->postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleExit));
return; return;
default: default:

View File

@@ -803,10 +803,12 @@ void GdbEngine::handleResultRecord(const GdbResponse &response)
responseWithCookie.cookie = cmd.cookie; responseWithCookie.cookie = cmd.cookie;
if (response.resultClass != GdbResultError && if (response.resultClass != GdbResultError &&
response.resultClass != ((cmd.flags & RunRequest) ? GdbResultRunning : GdbResultDone)) { response.resultClass != ((cmd.flags & RunRequest) ? GdbResultRunning :
debugMessage(_("UNEXPECTED RESPONSE %1 TO COMMAND %2") (cmd.flags & ExitRequest) ? GdbResultExit :
.arg(_(GdbResponse::stringFromResultClass(response.resultClass))) GdbResultDone)) {
.arg(cmd.command)); QString rsp = _(GdbResponse::stringFromResultClass(response.resultClass));
qWarning() << "UNEXPECTED RESPONSE " << rsp << " TO COMMAND" << cmd.command << " AT " __FILE__ ":" STRINGIFY(__LINE__);
debugMessage(_("UNEXPECTED RESPONSE %1 TO COMMAND %2").arg(rsp).arg(cmd.command));
} else { } else {
if (cmd.callback) if (cmd.callback)
(this->*cmd.callback)(responseWithCookie); (this->*cmd.callback)(responseWithCookie);

View File

@@ -177,7 +177,8 @@ public: // otherwise the Qt flag macros are unhappy
RebuildModel = 4, // Trigger model rebuild when no such commands are pending any more RebuildModel = 4, // Trigger model rebuild when no such commands are pending any more
WatchUpdate = Discardable | RebuildModel, WatchUpdate = Discardable | RebuildModel,
EmbedToken = 8, // Expand %1 in the command to the command token EmbedToken = 8, // Expand %1 in the command to the command token
RunRequest = 16 // Callback expect GdbResultRunning instead of GdbResultDone RunRequest = 16, // Callback expect GdbResultRunning instead of GdbResultDone
ExitRequest = 32 // Callback expect GdbResultExit instead of GdbResultDone
}; };
Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag) Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag)

View File

@@ -177,7 +177,7 @@ void PlainGdbAdapter::shutdown()
case InferiorShutDown: case InferiorShutDown:
setState(AdapterShuttingDown); setState(AdapterShuttingDown);
m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); m_engine->postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleExit));
return; return;
/* /*
@@ -192,7 +192,7 @@ void PlainGdbAdapter::shutdown()
.arg(state())); .arg(state()));
m_gdbProc.kill(); m_gdbProc.kill();
} }
m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); m_engine->postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleExit));
return; return;
*/ */
default: default:

View File

@@ -248,7 +248,7 @@ void RemoteGdbAdapter::shutdown()
case InferiorStartFailed: case InferiorStartFailed:
case InferiorShutDown: case InferiorShutDown:
setState(AdapterShuttingDown); setState(AdapterShuttingDown);
m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); m_engine->postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleExit));
return; return;
} }

View File

@@ -2015,7 +2015,7 @@ void TrkGdbAdapter::shutdown()
case InferiorShutDown: case InferiorShutDown:
setState(AdapterShuttingDown); setState(AdapterShuttingDown);
cleanup(); cleanup();
m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); m_engine->postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleExit));
return; return;
/* /*