Commit 398c1fd9 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen

more thoughtfull setTokenBarrier() placement

also, make it complain upon abuse of this call.

Conflicts:

	src/plugins/debugger/gdbengine.cpp
parent 265866f6
...@@ -776,9 +776,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record) ...@@ -776,9 +776,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
GdbCookie cmd = m_cookieForToken.take(token); GdbCookie cmd = m_cookieForToken.take(token);
// FIXME: this falsely rejects results from the custom dumper recognition if (record.token < m_oldestAcceptableToken) {
// procedure, too...
if (record.token < m_oldestAcceptableToken && cmd.type >= 300) {
//qDebug() << "### SKIPPING OLD RESULT " << record.toString(); //qDebug() << "### SKIPPING OLD RESULT " << record.toString();
//QMessageBox::information(m_mainWindow, tr("Skipped"), "xxx"); //QMessageBox::information(m_mainWindow, tr("Skipped"), "xxx");
return; return;
...@@ -1659,13 +1657,11 @@ bool GdbEngine::startDebugger() ...@@ -1659,13 +1657,11 @@ bool GdbEngine::startDebugger()
sendCommand("attach " + QString::number(q->m_attachedPID)); sendCommand("attach " + QString::number(q->m_attachedPID));
} else { } else {
// StartInternal or StartExternal // StartInternal or StartExternal
emit gdbInputAvailable(QString(), QString());
sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols); sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols);
//sendCommand("file " + fileName, GdbFileExecAndSymbols); //sendCommand("file " + fileName, GdbFileExecAndSymbols);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
sendCommand("sharedlibrary apply-load-rules all"); sendCommand("sharedlibrary apply-load-rules all");
#endif #endif
//setTokenBarrier();
if (!q->m_processArgs.isEmpty()) if (!q->m_processArgs.isEmpty())
sendCommand("-exec-arguments " + q->m_processArgs.join(" ")); sendCommand("-exec-arguments " + q->m_processArgs.join(" "));
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
...@@ -1687,7 +1683,6 @@ void GdbEngine::continueInferior() ...@@ -1687,7 +1683,6 @@ void GdbEngine::continueInferior()
{ {
q->resetLocation(); q->resetLocation();
setTokenBarrier(); setTokenBarrier();
emit gdbInputAvailable(QString(), QString());
qq->notifyInferiorRunningRequested(); qq->notifyInferiorRunningRequested();
sendCommand("-exec-continue", GdbExecContinue); sendCommand("-exec-continue", GdbExecContinue);
} }
...@@ -1722,7 +1717,6 @@ void GdbEngine::handleStart(const GdbResultRecord &response) ...@@ -1722,7 +1717,6 @@ void GdbEngine::handleStart(const GdbResultRecord &response)
void GdbEngine::stepExec() void GdbEngine::stepExec()
{ {
setTokenBarrier(); setTokenBarrier();
emit gdbInputAvailable(QString(), QString());
qq->notifyInferiorRunningRequested(); qq->notifyInferiorRunningRequested();
sendCommand("-exec-step", GdbExecStep); sendCommand("-exec-step", GdbExecStep);
} }
...@@ -1744,7 +1738,6 @@ void GdbEngine::stepOutExec() ...@@ -1744,7 +1738,6 @@ void GdbEngine::stepOutExec()
void GdbEngine::nextExec() void GdbEngine::nextExec()
{ {
setTokenBarrier(); setTokenBarrier();
emit gdbInputAvailable(QString(), QString());
qq->notifyInferiorRunningRequested(); qq->notifyInferiorRunningRequested();
sendCommand("-exec-next", GdbExecNext); sendCommand("-exec-next", GdbExecNext);
} }
...@@ -1796,14 +1789,19 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber) ...@@ -1796,14 +1789,19 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber)
/*! /*!
\fn void GdbEngine::setTokenBarrier() \fn void GdbEngine::setTokenBarrier()
\brief Sets up internal structures to handle a new debugger turn. \brief Discard the results of all pending watch-updating commands.
This method is called at the beginning of all step/next/finish etc. This method is called at the beginning of all step/next/finish etc.
debugger functions. debugger functions.
If non-watch-updating commands with call-backs are still in the pipe,
it will complain.
*/ */
void GdbEngine::setTokenBarrier() void GdbEngine::setTokenBarrier()
{ {
foreach (const GdbCookie &ck, m_cookieForToken)
QTC_ASSERT(ck.synchronized || ck.type == GdbInvalidCommand, return);
emit gdbInputAvailable(QString(), "--- token barrier ---");
m_oldestAcceptableToken = currentToken(); m_oldestAcceptableToken = currentToken();
} }
...@@ -2494,6 +2492,8 @@ void GdbEngine::activateFrame(int frameIndex) ...@@ -2494,6 +2492,8 @@ void GdbEngine::activateFrame(int frameIndex)
QTC_ASSERT(frameIndex < stackHandler->stackSize(), return); QTC_ASSERT(frameIndex < stackHandler->stackSize(), return);
if (oldIndex != frameIndex) { if (oldIndex != frameIndex) {
setTokenBarrier();
// Assuming this always succeeds saves a roundtrip. // Assuming this always succeeds saves a roundtrip.
// Otherwise the lines below would need to get triggered // Otherwise the lines below would need to get triggered
// after a response to this -stack-select-frame here. // after a response to this -stack-select-frame here.
...@@ -2970,6 +2970,7 @@ void GdbEngine::setUseCustomDumpers(bool on) ...@@ -2970,6 +2970,7 @@ void GdbEngine::setUseCustomDumpers(bool on)
Q_UNUSED(on); Q_UNUSED(on);
// FIXME: a bit too harsh, but otherwise the treeview sometimes look funny // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
//m_expandedINames.clear(); //m_expandedINames.clear();
setTokenBarrier();
updateLocals(); updateLocals();
} }
...@@ -3444,6 +3445,7 @@ void GdbEngine::handleVarAssign() ...@@ -3444,6 +3445,7 @@ void GdbEngine::handleVarAssign()
// everything might have changed, force re-evaluation // everything might have changed, force re-evaluation
// FIXME: Speed this up by re-using variables and only // FIXME: Speed this up by re-using variables and only
// marking values as 'unknown' // marking values as 'unknown'
setTokenBarrier();
updateLocals(); updateLocals();
} }
...@@ -3660,8 +3662,6 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, ...@@ -3660,8 +3662,6 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
void GdbEngine::updateLocals() void GdbEngine::updateLocals()
{ {
setTokenBarrier();
m_pendingRequests = 0; m_pendingRequests = 0;
PENDING_DEBUG("\nRESET PENDING"); PENDING_DEBUG("\nRESET PENDING");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment