OSDN Git Service

debugger: fix some breakpoint state transitions in gdb engine
authorhjk <qtc-committer@nokia.com>
Thu, 18 Nov 2010 15:16:23 +0000 (16:16 +0100)
committerhjk <qtc-committer@nokia.com>
Thu, 18 Nov 2010 15:16:23 +0000 (16:16 +0100)
src/plugins/debugger/breakhandler.cpp
src/plugins/debugger/breakhandler.h
src/plugins/debugger/gdb/gdbengine.cpp

index 370eb83..ab309e6 100644 (file)
@@ -678,6 +678,12 @@ void BreakHandler::notifyBreakpointRemoveFailed(BreakpointId id)
     cleanupBreakpoint(id);
 }
 
+void BreakHandler::notifyBreakpointChangeProceeding(BreakpointId id)
+{
+    QTC_ASSERT(state(id) == BreakpointChangeRequested, /**/);
+    setState(id, BreakpointChangeProceeding);
+}
+
 void BreakHandler::notifyBreakpointChangeOk(BreakpointId id)
 {
     QTC_ASSERT(state(id) == BreakpointChangeProceeding, /**/);
index c9ee854..38d5705 100644 (file)
@@ -132,6 +132,7 @@ public:
     void notifyBreakpointInsertOk(BreakpointId id);
     void notifyBreakpointInsertFailed(BreakpointId id);
     void notifyBreakpointChangeOk(BreakpointId id);
+    void notifyBreakpointChangeProceeding(BreakpointId id);
     void notifyBreakpointChangeFailed(BreakpointId id);
     void notifyBreakpointPending(BreakpointId id);
     void notifyBreakpointRemoveProceeding(BreakpointId id);
index 2454691..79071bc 100644 (file)
@@ -2622,31 +2622,42 @@ void GdbEngine::insertBreakpoint(BreakpointId id)
 
 void GdbEngine::changeBreakpoint(BreakpointId id)
 {
-    const BreakpointParameters &data = breakHandler()->breakpointData(id);
+    BreakHandler *handler = breakHandler();
+    const BreakpointParameters &data = handler->breakpointData(id);
     QTC_ASSERT(data.type != UnknownType, return);
-    const BreakpointResponse &response = breakHandler()->response(id);
+    const BreakpointResponse &response = handler->response(id);
     QTC_ASSERT(response.number > 0, return);
     const QByteArray bpnr = QByteArray::number(response.number);
+    QTC_ASSERT(response.number > 0, return);
 
+    bool finished = true;
     if (data.condition != response.condition
         && !data.conditionsMatch(response.condition)) {
         // Update conditions if needed.
+        handler->notifyBreakpointChangeProceeding(id);
+        finished = false;
         postCommand("condition " + bpnr + ' '  + data.condition,
             NeedsStop | RebuildBreakpointModel,
             CB(handleBreakCondition), id);
     }
     if (data.ignoreCount != response.ignoreCount) {
         // Update ignorecount if needed.
+        handler->notifyBreakpointChangeProceeding(id);
+        finished = false;
         postCommand("ignore " + bpnr + ' ' + QByteArray::number(data.ignoreCount),
             NeedsStop | RebuildBreakpointModel,
             CB(handleBreakIgnore), id);
     }
     if (!data.enabled && response.enabled) {
+        handler->notifyBreakpointChangeProceeding(id);
+        finished = false;
         postCommand("-break-disable " + bpnr,
             NeedsStop | RebuildBreakpointModel,
             CB(handleBreakDisable), id);
     }
     if (data.enabled && !response.enabled) {
+        handler->notifyBreakpointChangeProceeding(id);
+        finished = false;
         postCommand("-break-enable " + bpnr,
             NeedsStop | RebuildBreakpointModel,
             CB(handleBreakEnable), id);
@@ -2663,6 +2674,9 @@ void GdbEngine::changeBreakpoint(BreakpointId id)
     }
 
     attemptAdjustBreakpointLocation(id);
+
+    if (finished)
+        handler->notifyBreakpointChangeOk(id);
 }
 
 void GdbEngine::removeBreakpoint(BreakpointId id)