+ self.feed_child("y\n");
+
+ def setBreakpoint(self, file, lineno, condition=None):
+ his = self.getHistoryLen()
+ if condition==None:
+ self.feed_child("break %s:%s\n" % (file, str(lineno)))
+ else:
+ self.feed_child("break %s:%s if %s\n" % \
+ (file, str(lineno), condition))
+
+ rx = re.compile("^Breakpoint |^No |^\(gdb\) ")
+ his, response = self.waitForRx(rx, his)
+
+ 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");
+
+ #Wait again for (gdb)...
+ self.waitForActivation(his)
+
+ return answer
+
+
+ def delBreakpoint(self, breakpoint):
+ self.feed_child("del breakpoint %s\n" % (breakpoint,))
+
+ def getBreakpoints(self):
+ starthis = self.getHistoryLen()
+ self.feed_child("info breakpoints\n")
+
+ rx = re.compile("^\(gdb\) ")
+ endhis, response = self.waitForRx(rx, starthis)
+
+
+ rxbp = re.compile("^\d+\s+breakpoint")
+ rxpos = re.compile("^.* at \S+:\d+$")
+ rxcond = re.compile("^\tstop only if")
+
+ bpnts = []
+ bplines = self.history[starthis+1:endhis]
+ i = 0
+
+ #Parse the resulting lines
+ while i<len(bplines):
+ line = bplines[i]
+
+ if not rxbp.search(line):
+ i += 1
+ continue
+
+ #Get number of breakpoint
+ no = string.split(line)[0]
+
+ #This line does not contain the file!
+ if not rxpos.search(line):
+ i += 1
+ line = bplines[i]
+
+ pos = string.split(line)[-1]
+ [file,lineno] = string.split(pos,":")
+ cond = None
+
+ if i+1<len(bplines) and rxcond.search(bplines[i+1]):
+ i +=1
+ line = bplines[i]
+ pre,cond = string.split(line,"if")
+ cond = cond.strip()
+
+ bpnts += [[no, file, lineno, cond]]
+ i += 1
+
+ return bpnts
+