bplines = self.__getAnswerFromCmd("info breakpoints\n")
rxbp = re.compile("^\d+\s+breakpoint")
- rxpos = re.compile("^.*at\s+\S+:\d+$")
+ rxpos = re.compile("at \S+:\d+$")
rxcond = re.compile("^\s+stop only if")
bpnts = []
- i = 1
- #Parse the resulting lines
- while i<len(bplines):
- line = bplines[i]
+ try:
+ i = 1
- if not rxbp.search(line):
- i += 1
- continue
-
- #Get number of breakpoint
- no = string.split(line)[0]
+ #Parse the resulting lines
+ while i<len(bplines):
- #This line does not contain the file!
- #Check for next line...
- if not rxpos.search(line):
- i += 1
line = bplines[i]
- if not rxpos.search(line):
- i += 1
- continue
+ while not rxbp.search(line):
+ i += 1
+ line = bplines[i]
+
+ #Get number of breakpoint
+ no = string.split(line)[0]
- pos = string.split(line)[-1]
- [file,lineno] = string.split(pos,":")
- cond = None
+ #This line does not contain the file!
+ #Check for next line...
+ while not rxpos.search(line):
+ i += 1
+ line = bplines[i]
- #Look for conditions
- if i+1<len(bplines) and rxcond.search(bplines[i+1]):
- i +=1
- line = bplines[i]
- cond = string.join(string.split(line," if ")[1:], " if ")
- cond = cond.strip()
+ pos = string.split(line)[-1]
+ [file,lineno] = string.split(pos,":")
+ cond = None
- bpnts += [[no, file, lineno, cond]]
- i += 1
+ #Look for conditions
+ if i+1<len(bplines) and rxcond.search(bplines[i+1]):
+ i +=1
+ line = bplines[i]
+ cond = string.join(string.split(line," if ")[1:], " if ")
+ cond = cond.strip()
+
+ bpnts += [[no, file, lineno, cond]]
+ i += 1
+
+ except IndexError:
+ pass
return bpnts
#Search for file position
while not rxpos.search(line):
- print "Warning: '", line, "' does not match file pos marker."
i+=1
line = answ[i]