From 162c3ac77fb35684824a2a8f975800dd9780bf10 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Wed, 11 Jun 2008 10:12:03 +0200 Subject: [PATCH] changed some stuff of active/inactive detection --- DbgTerminal.py | 25 ++++++++++++++++++------- GdbTerminal.py | 9 +++++++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/DbgTerminal.py b/DbgTerminal.py index 005661c..ebe4e1a 100644 --- a/DbgTerminal.py +++ b/DbgTerminal.py @@ -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 + diff --git a/GdbTerminal.py b/GdbTerminal.py index 8600c90..15cb11d 100755 --- a/GdbTerminal.py +++ b/GdbTerminal.py @@ -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 -- 2.30.2