changed some stuff of active/inactive detection
authorStefan Huber <shuber2@gmail.com>
Wed, 11 Jun 2008 08:12:03 +0000 (10:12 +0200)
committerStefan Huber <shuber2@gmail.com>
Wed, 11 Jun 2008 08:12:03 +0000 (10:12 +0200)
DbgTerminal.py
GdbTerminal.py

index 005661ce3e4aeff79f2bcea9461a8389555e7929..ebe4e1a2f147ed16bb8c37474724d02f4811dded 100644 (file)
@@ -73,9 +73,11 @@ class DbgTerminal (vte.Terminal):
 
                                status, param = res
                                if self.isActive():
+                                       print "got active: ", res
                                        for cb in self.gotActiveCallback:
                                                cb(status, param)
                                else:
+                                       print "got inactive: ", res
                                        for cb in self.gotInactiveCallback:
                                                cb(status, param)
                except:
@@ -99,7 +101,7 @@ class DbgTerminal (vte.Terminal):
                lines = string.split(text, "\n")
 
                #Remove the incomplete line
-               len = max(0,self.getHistoryLen()-1)
+               len = max(0,self.getHistoryLen())
                self.history[-1] += lines[0]
                self.history += lines[1:]
 
@@ -107,16 +109,25 @@ class DbgTerminal (vte.Terminal):
                #Check if activity status has been changed
                for i in range(len, self.getHistoryLen()):
                        line = self.history[i]
+                                       
+                       res = self.testForInactivity(i)
+                       if res != None:
+                               while self.activityChanged != None:
+                                       print "wait for pending activity"
+                                       gtk.main_iteration()
+
+                               self.setActive(False)
+                               self.activityChanged = res
 
                        res = self.testForActivity(i)
-                       if res != None and not self.isActive():
+                       if res != None:
+                               while self.activityChanged != None:
+                                       print "wait for pending activity"
+                                       gtk.main_iteration()
+
                                self.setActive(True)
                                self.activityChanged = res
-                               
-                       res = self.testForInactivity(i)
-                       if res != None and self.isActive():
-                               self.setActive(False)
-                               self.activityChanged = res
+
 
 
 
index 8600c90d0a94e4e7f1f1733f15a1bf70f8551727..15cb11df2bb233c8c7881db3e2c255cf0de77327 100755 (executable)
@@ -179,15 +179,20 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
        def testForInactivity(self, his):
                """Test whether debugger got inactive"""                
                line = self.history[his]
-               rxcont = re.compile("^\(gdb\)\s+(cont|step|next|stepi|nexti)")
 
                if string.find(line, "Starting program:") == 0:
                        prog = string.join( string.split(line)[1:])
                        return "started", prog
 
-               if rxcont.search(line):
+               if string.find(line, "Continuing.") == 0:
                        return "continued", None
 
+               if string.find(line, "\x1a\x1a") == 0:
+                       rxcont = re.compile("^\(gdb\)\s+(cont|step|next|stepi|nexti)")
+
+                       if rxcont.search(self.history[his-1]):
+                               return "stepped", None
+
                return None