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)
|
if (cmd.callback)
|
||||||
cmd.callback(*response);
|
cmd.callback(*response);
|
||||||
|
|
||||||
// Continue only if there are no commands wire anymore, so this will
|
PENDING_DEBUG("MISSING TOKENS: " << m_commandForToken.keys());
|
||||||
// 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());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_commandForToken.isEmpty())
|
if (m_commandForToken.isEmpty())
|
||||||
m_commandTimer.stop();
|
m_commandTimer.stop();
|
||||||
@@ -3863,7 +3849,6 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, Id settingsIdHint)
|
|||||||
void GdbEngine::prepareForRestart()
|
void GdbEngine::prepareForRestart()
|
||||||
{
|
{
|
||||||
m_rerunPending = false;
|
m_rerunPending = false;
|
||||||
m_commandsDoneCallback = nullptr;
|
|
||||||
m_commandForToken.clear();
|
m_commandForToken.clear();
|
||||||
m_flagsForToken.clear();
|
m_flagsForToken.clear();
|
||||||
}
|
}
|
||||||
@@ -3880,18 +3865,6 @@ void GdbEngine::handleInferiorPrepared()
|
|||||||
runCommand({command, NativeCommand});
|
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.
|
if (runParameters().startMode != AttachCore) { // No breakpoints in core files.
|
||||||
const bool onAbort = boolSetting(BreakOnAbort);
|
const bool onAbort = boolSetting(BreakOnAbort);
|
||||||
const bool onWarning = boolSetting(BreakOnWarning);
|
const bool onWarning = boolSetting(BreakOnWarning);
|
||||||
@@ -4385,7 +4358,7 @@ void GdbEngine::shutdownEngine()
|
|||||||
|
|
||||||
CHECK_STATE(EngineShutdownRequested);
|
CHECK_STATE(EngineShutdownRequested);
|
||||||
showMessage(QString("INITIATE GDBENGINE SHUTDOWN, PROC STATE: %1").arg(m_gdbProc.state()));
|
showMessage(QString("INITIATE GDBENGINE SHUTDOWN, PROC STATE: %1").arg(m_gdbProc.state()));
|
||||||
m_commandsDoneCallback = nullptr;
|
|
||||||
switch (m_gdbProc.state()) {
|
switch (m_gdbProc.state()) {
|
||||||
case QProcess::Running: {
|
case QProcess::Running: {
|
||||||
if (runParameters().closeMode == KillAndExitMonitorAtClose)
|
if (runParameters().closeMode == KillAndExitMonitorAtClose)
|
||||||
|
@@ -103,11 +103,8 @@ private: ////////// General Interface //////////
|
|||||||
void handleAdapterStartFailed(const QString &msg,
|
void handleAdapterStartFailed(const QString &msg,
|
||||||
Utils::Id settingsIdHint = Utils::Id());
|
Utils::Id settingsIdHint = Utils::Id());
|
||||||
|
|
||||||
// This triggers the initial breakpoint synchronization and causes
|
// Called after target setup.
|
||||||
// finishInferiorSetup() being called once done.
|
|
||||||
void handleInferiorPrepared();
|
void handleInferiorPrepared();
|
||||||
// This notifies the base of a successful inferior setup.
|
|
||||||
void finishInferiorSetup();
|
|
||||||
|
|
||||||
void handleDebugInfoLocation(const DebuggerResponse &response);
|
void handleDebugInfoLocation(const DebuggerResponse &response);
|
||||||
|
|
||||||
@@ -156,10 +153,6 @@ private: ////////// General Interface //////////
|
|||||||
int m_oldestAcceptableToken = -1;
|
int m_oldestAcceptableToken = -1;
|
||||||
int m_nonDiscardableCount = 0;
|
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;
|
bool m_rerunPending = false;
|
||||||
|
|
||||||
////////// Gdb Output, State & Capability Handling //////////
|
////////// Gdb Output, State & Capability Handling //////////
|
||||||
|
Reference in New Issue
Block a user