]> git.sthu.org Git - pygdb.git/commitdiff
some code beautifying: __waitForPrompt
authorStefan Huber <shuber2@gmail.com>
Tue, 10 Jun 2008 14:52:14 +0000 (16:52 +0200)
committerStefan Huber <shuber2@gmail.com>
Tue, 10 Jun 2008 14:52:14 +0000 (16:52 +0200)
GdbTerminal.py

index 7c282360501232a26a97acedbceeec10b286e50e..f468f89fe1f718fb99e870bf3b21abe0b10ff2b9 100755 (executable)
@@ -30,7 +30,6 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                self.waitForActivation(his)
 
        def setRun(self):
-
                his = self.getHistoryLen()
                argv = string.join(string.split(self.clientCmd)[1:])
                self.feed_child("run " + argv + "\n")
@@ -83,15 +82,14 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
 
 
        def delBreakpoint(self, breakpoint):
+               his = self.getHistoryLen()
                self.feed_child("del breakpoint %s\n" % (breakpoint,))
+               self.waitForActivation(his)
 
        def getBreakpoints(self):
                starthis = self.getHistoryLen()
                self.feed_child("info breakpoints\n")
-
-               rx = re.compile("^\(gdb\) ")
-               endhis, response = self.waitForRx(rx, starthis)
-
+               endhis, response = self.__waitForPrompt(starthis)
 
                rxbp = re.compile("^\d+\s+breakpoint")
                rxpos = re.compile("^.* at \S+:\d+$")
@@ -138,10 +136,7 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
 
                his = self.getHistoryLen()
                self.feed_child("print " + expr + "\n")
-
-               rx = re.compile("^\(gdb\)")
-               his, response = self.waitForRx(rx, his)
-
+               his, response = self.__waitForPrompt(his)
                answer = self.history[his-1]
 
                if len(string.split(answer, "=")) == 1:
@@ -154,8 +149,7 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
        def waitForActivation(self, starthis):
 
                self.setActive(False)
-               rx = re.compile("^\(gdb\)")
-               endhis, response = self.waitForRx(rx,starthis)
+               endhis, response = self.__waitForPrompt(starthis)
                self.setActive(True)
 
                for his in reversed(range(starthis+1,endhis)):
@@ -166,6 +160,12 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                return None
 
 
+       def __waitForPrompt(self, his):
+               rx = re.compile("^\(gdb\) ")
+               return self.waitForRx(rx,his)
+
+
+
 
 if __name__ == "__main__":