X-Git-Url: https://git.sthu.org/?p=pygdb.git;a=blobdiff_plain;f=GdbTerminal.py;h=bcd857ac5ef5428fdc0fc435a57a0cba5d8b7047;hp=12256c1d0066e73b4d1f80dc69afbceae38f1cc8;hb=e3403072dbc8f31817f6492dea70ebdf5128fcb2;hpb=0024f43ac5834f611179587a6fc25385ee5bf4a5 diff --git a/GdbTerminal.py b/GdbTerminal.py index 12256c1..bcd857a 100755 --- a/GdbTerminal.py +++ b/GdbTerminal.py @@ -32,23 +32,23 @@ class GdbTerminal (DbgTerminal.DbgTerminal): his = self.getHistoryLen() argv = string.join(string.split(self.clientCmd)[1:]) self.feed_dbg("run " + argv + "\n") - return self.waitForPosition(his) + return self.waitForActivation(his) def setContinue(self): his = self.getHistoryLen() self.feed_dbg("cont\n"); - return self.waitForPosition(his) + return self.waitForActivation(his) def setStepover(self): his = self.getHistoryLen() self.feed_dbg("next\n"); - return self.waitForPosition(his) + return self.waitForActivation(his) def setStepin(self): his = self.getHistoryLen() self.feed_dbg("step\n"); - return self.waitForPosition(his) + return self.waitForActivation(his) def setQuit(self): self.feed_dbg("quit\n") @@ -63,16 +63,24 @@ class GdbTerminal (DbgTerminal.DbgTerminal): his = self.getHistoryLen() self.feed_dbg("print " + expr + "\n") - rx = re.compile("^\$[1-9][0-9]* = .*$") + rx = re.compile("^\(gdb\) $") his, response = self.waitForRx(rx, his) - split = string.split(response, "=") + answer = self.history[his-1] + + if len(string.split(answer, "=")) == 1: + return answer.strip() + + split = string.split(answer, "=") return string.join(split[1:], "=").strip() - def waitForPosition(self, his): + def waitForActivation(self, his): + + self.setActive(False) rx = re.compile("^\(gdb\) $") his, reponse = self.waitForRx(rx,his) + self.setActive(True) if self.history[his-1][0:2]=="\x1a\x1a": tuples = string.split(self.history[his-1][2:], ":")