X-Git-Url: https://git.sthu.org/?p=pygdb.git;a=blobdiff_plain;f=GdbTerminal.py;h=f468f89fe1f718fb99e870bf3b21abe0b10ff2b9;hp=7c282360501232a26a97acedbceeec10b286e50e;hb=d7a00b7d9d8b49655f714abc53361bed08e0355d;hpb=ddcbe9f3a277c8e454aeadcedfc6cad81a997a19 diff --git a/GdbTerminal.py b/GdbTerminal.py index 7c28236..f468f89 100755 --- a/GdbTerminal.py +++ b/GdbTerminal.py @@ -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__":