forked from qt-creator/qt-creator
Debugger: Simplify gdb startup
The reason for the special callback setup is lost in history. A possibility is that the extra roundtrip was needed for synchronization with earlier gdb versions and/or start up sequences. It seems to works fine without nowadays. Change-Id: I28c95aec2f065e9c6f0730f1ffbc3db1a3d819da Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -980,21 +980,7 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response)
|
||||
if (cmd.callback)
|
||||
cmd.callback(*response);
|
||||
|
||||
// Continue only if there are no commands wire anymore, so this will
|
||||
// be fully synchronous.
|
||||
// This is somewhat inefficient, as it makes the last command synchronous.
|
||||
// An optimization would be requesting the continue immediately when the
|
||||
// event loop is entered, and let individual commands have a flag to suppress
|
||||
// that behavior.
|
||||
if (m_commandsDoneCallback && m_commandForToken.isEmpty()) {
|
||||
showMessage("ALL COMMANDS DONE; INVOKING CALLBACK");
|
||||
CommandsDoneCallback cont = m_commandsDoneCallback;
|
||||
m_commandsDoneCallback = nullptr;
|
||||
if (response->resultClass != ResultRunning) //only start if the thing is not already running
|
||||
(this->*cont)();
|
||||
} else {
|
||||
PENDING_DEBUG("MISSING TOKENS: " << m_commandForToken.keys());
|
||||
}
|
||||
PENDING_DEBUG("MISSING TOKENS: " << m_commandForToken.keys());
|
||||
|
||||
if (m_commandForToken.isEmpty())
|
||||
m_commandTimer.stop();
|
||||
@@ -3863,7 +3849,6 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, Id settingsIdHint)
|
||||
void GdbEngine::prepareForRestart()
|
||||
{
|
||||
m_rerunPending = false;
|
||||
m_commandsDoneCallback = nullptr;
|
||||
m_commandForToken.clear();
|
||||
m_flagsForToken.clear();
|
||||
}
|
||||
@@ -3880,18 +3865,6 @@ void GdbEngine::handleInferiorPrepared()
|
||||
runCommand({command, NativeCommand});
|
||||
}
|
||||
|
||||
if (m_commandForToken.isEmpty()) {
|
||||
finishInferiorSetup();
|
||||
} else {
|
||||
QTC_CHECK(m_commandsDoneCallback == nullptr);
|
||||
m_commandsDoneCallback = &GdbEngine::finishInferiorSetup;
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::finishInferiorSetup()
|
||||
{
|
||||
CHECK_STATE(EngineSetupRequested);
|
||||
|
||||
if (runParameters().startMode != AttachCore) { // No breakpoints in core files.
|
||||
const bool onAbort = boolSetting(BreakOnAbort);
|
||||
const bool onWarning = boolSetting(BreakOnWarning);
|
||||
@@ -4385,7 +4358,7 @@ void GdbEngine::shutdownEngine()
|
||||
|
||||
CHECK_STATE(EngineShutdownRequested);
|
||||
showMessage(QString("INITIATE GDBENGINE SHUTDOWN, PROC STATE: %1").arg(m_gdbProc.state()));
|
||||
m_commandsDoneCallback = nullptr;
|
||||
|
||||
switch (m_gdbProc.state()) {
|
||||
case QProcess::Running: {
|
||||
if (runParameters().closeMode == KillAndExitMonitorAtClose)
|
||||
|
@@ -103,11 +103,8 @@ private: ////////// General Interface //////////
|
||||
void handleAdapterStartFailed(const QString &msg,
|
||||
Utils::Id settingsIdHint = Utils::Id());
|
||||
|
||||
// This triggers the initial breakpoint synchronization and causes
|
||||
// finishInferiorSetup() being called once done.
|
||||
// Called after target setup.
|
||||
void handleInferiorPrepared();
|
||||
// This notifies the base of a successful inferior setup.
|
||||
void finishInferiorSetup();
|
||||
|
||||
void handleDebugInfoLocation(const DebuggerResponse &response);
|
||||
|
||||
@@ -156,10 +153,6 @@ private: ////////// General Interface //////////
|
||||
int m_oldestAcceptableToken = -1;
|
||||
int m_nonDiscardableCount = 0;
|
||||
|
||||
using CommandsDoneCallback = void (GdbEngine::*)();
|
||||
// This function is called after all previous responses have been received.
|
||||
CommandsDoneCallback m_commandsDoneCallback = nullptr;
|
||||
|
||||
bool m_rerunPending = false;
|
||||
|
||||
////////// Gdb Output, State & Capability Handling //////////
|
||||
|
Reference in New Issue
Block a user