X-Git-Url: https://git.sthu.org/?p=pygdb.git;a=blobdiff_plain;f=GdbTerminal.py;h=77d21e2f6e3fbffab0c3143214bca2ff1dd8db31;hp=bcd857ac5ef5428fdc0fc435a57a0cba5d8b7047;hb=9a8e5a643a533e00a2c8fdd6f03ea7b7a5e5d649;hpb=e3403072dbc8f31817f6492dea70ebdf5128fcb2 diff --git a/GdbTerminal.py b/GdbTerminal.py index bcd857a..77d21e2 100755 --- a/GdbTerminal.py +++ b/GdbTerminal.py @@ -55,8 +55,75 @@ class GdbTerminal (DbgTerminal.DbgTerminal): self.waitForNewline() self.feed_dbg("y\n"); - def setBreakpoint(self, file, lineno): - self.feed_dbg("break %s:%d\n" % (file, lineno)) + def setBreakpoint(self, file, lineno, condition=None): + his = self.getHistoryLen() + if condition==None: + self.feed_dbg("break %s:%s\n" % (file, str(lineno))) + else: + self.feed_dbg("break %s:%s if %s\n" % \ + (file, str(lineno), condition)) + + rx = re.compile("^Breakpoint |^No|^\(gdb\) ") + his, response = self.waitForRx(rx, his) + + + if response[0:10] == "Breakpoint": + return string.split(response)[1].strip() + if response[0:5] == "(gdb)": + return None + if response[0:14] == "No source file": + self.feed_dbg("n\n"); + return None + if response[0:3] == "No ": + return None + + return NotImplementedError() + + def delBreakpoint(self, breakpoint): + self.feed_dbg("del breakpoint %s\n" % (breakpoint,)) + + def getBreakpoints(self): + starthis = self.getHistoryLen() + self.feed_dbg("info breakpoints\n") + + rx = re.compile("^\(gdb\) ") + endhis, response = self.waitForRx(rx, starthis) + + + rxbp1 = re.compile("^\d+\s+breakpoint") + rxbp2 = re.compile("^\tstop only if") + + bpnts = [] + bplines = self.history[starthis+1:endhis] + i = 0 + + #Parse the resulting lines + while i