OSDN Git Service

more thoughtfull setTokenBarrier() placement
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Tue, 24 Feb 2009 13:38:57 +0000 (14:38 +0100)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Tue, 24 Feb 2009 14:09:26 +0000 (15:09 +0100)
also, make it complain upon abuse of this call.

Conflicts:

src/plugins/debugger/gdbengine.cpp

src/plugins/debugger/gdbengine.cpp

index 6fc0423..7067223 100644 (file)
@@ -776,9 +776,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
 
     GdbCookie cmd = m_cookieForToken.take(token);
 
-    // FIXME: this falsely rejects results from the custom dumper recognition
-    // procedure, too...
-    if (record.token < m_oldestAcceptableToken && cmd.type >= 300) {
+    if (record.token < m_oldestAcceptableToken) {
         //qDebug() << "### SKIPPING OLD RESULT " << record.toString();
         //QMessageBox::information(m_mainWindow, tr("Skipped"), "xxx");
         return;
@@ -1659,13 +1657,11 @@ bool GdbEngine::startDebugger()
         sendCommand("attach " + QString::number(q->m_attachedPID));
     } else {
         // StartInternal or StartExternal
-        emit gdbInputAvailable(QString(), QString());
         sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols);
         //sendCommand("file " + fileName, GdbFileExecAndSymbols);
         #ifdef Q_OS_MAC
         sendCommand("sharedlibrary apply-load-rules all");
         #endif
-        //setTokenBarrier();
         if (!q->m_processArgs.isEmpty())
             sendCommand("-exec-arguments " + q->m_processArgs.join(" "));
         #ifndef Q_OS_MAC
@@ -1687,7 +1683,6 @@ void GdbEngine::continueInferior()
 {
     q->resetLocation();
     setTokenBarrier();
-    emit gdbInputAvailable(QString(), QString());
     qq->notifyInferiorRunningRequested();
     sendCommand("-exec-continue", GdbExecContinue);
 }
@@ -1722,7 +1717,6 @@ void GdbEngine::handleStart(const GdbResultRecord &response)
 void GdbEngine::stepExec()
 {
     setTokenBarrier();
-    emit gdbInputAvailable(QString(), QString());
     qq->notifyInferiorRunningRequested();
     sendCommand("-exec-step", GdbExecStep);
 }
@@ -1744,7 +1738,6 @@ void GdbEngine::stepOutExec()
 void GdbEngine::nextExec()
 {
     setTokenBarrier();
-    emit gdbInputAvailable(QString(), QString());
     qq->notifyInferiorRunningRequested();
     sendCommand("-exec-next", GdbExecNext);
 }
@@ -1796,14 +1789,19 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber)
 
 /*!
     \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.
     debugger functions.
+    If non-watch-updating commands with call-backs are still in the pipe,
+    it will complain.
 */
 
 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();
 }
 
@@ -2494,6 +2492,8 @@ void GdbEngine::activateFrame(int frameIndex)
     QTC_ASSERT(frameIndex < stackHandler->stackSize(), return);
 
     if (oldIndex != frameIndex) {
+        setTokenBarrier();
+
         // Assuming this always succeeds saves a roundtrip.
         // Otherwise the lines below would need to get triggered
         // after a response to this -stack-select-frame here.
@@ -2970,6 +2970,7 @@ void GdbEngine::setUseCustomDumpers(bool on)
     Q_UNUSED(on);
     // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
     //m_expandedINames.clear();
+    setTokenBarrier();
     updateLocals();
 }
 
@@ -3444,6 +3445,7 @@ void GdbEngine::handleVarAssign()
     // everything might have changed, force re-evaluation
     // FIXME: Speed this up by re-using variables and only
     // marking values as 'unknown'
+    setTokenBarrier();
     updateLocals();
 }
 
@@ -3660,8 +3662,6 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
 
 void GdbEngine::updateLocals()
 {
-    setTokenBarrier();
-
     m_pendingRequests = 0;
 
     PENDING_DEBUG("\nRESET PENDING");