- moving pygdb path to .gvimrc
[pygdb.git] / GdbTerminal.py
index 7341cae049379a2f9342e887f482f43acef56fdf..7c282360501232a26a97acedbceeec10b286e50e 100755 (executable)
@@ -25,7 +25,9 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
 
        def setPty(self, pty):
                ttyname = os.ttyname(pty)
+               his = self.getHistoryLen()
                self.feed_child("set inferior-tty %s\n" % (ttyname,))
+               self.waitForActivation(his)
 
        def setRun(self):
 
@@ -65,18 +67,19 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                rx = re.compile("^Breakpoint |^No |^\(gdb\) ")
                his, response = self.waitForRx(rx, his)
 
-               if response[0:10] == "Breakpoint":
-                       return string.split(response)[1].strip()
+               answer = None
 
+               if response[0:10] == "Breakpoint":
+                       answer = string.split(response)[1].strip()
+               
+               #Wants an answer: "No"
                if response[0:14] == "No source file":
                        self.feed_child("n\n");
-                       return None
 
-               #Wait again for gdb
-               if response[0:5] != "(gdb)":
-                       his, response = self.waitForRx(rx,his)
+               #Wait again for (gdb)...
+               self.waitForActivation(his)
 
-               return None
+               return answer
 
 
        def delBreakpoint(self, breakpoint):
@@ -136,7 +139,7 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                his = self.getHistoryLen()
                self.feed_child("print " + expr + "\n")
 
-               rx = re.compile("^\(gdb\) $")
+               rx = re.compile("^\(gdb\)")
                his, response = self.waitForRx(rx, his)
 
                answer = self.history[his-1]
@@ -148,14 +151,11 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                return string.join(split[1:], "=").strip()
 
 
-       def waitForActivation(self, starthis=None):
-
-               if starthis == None:
-                       starthis = self.getHistoryLen()
+       def waitForActivation(self, starthis):
 
                self.setActive(False)
-               rx = re.compile("^\(gdb\) $")
-               endhis, reponse = self.waitForRx(rx,starthis)
+               rx = re.compile("^\(gdb\)")
+               endhis, response = self.waitForRx(rx,starthis)
                self.setActive(True)
 
                for his in reversed(range(starthis+1,endhis)):