fixing breakpoint bug
authorStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 21:19:04 +0000 (23:19 +0200)
committerStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 21:19:04 +0000 (23:19 +0200)
 - sometimes its possible that the "at xxx:dd" line is on the next line

GdbTerminal.py
pygdb.vim

index 304e39ab622185cd2132e616fe17c0cd5c89b261..7341cae049379a2f9342e887f482f43acef56fdf 100755 (executable)
@@ -90,8 +90,9 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                endhis, response = self.waitForRx(rx, starthis)
 
 
-               rxbp1 = re.compile("^\d+\s+breakpoint")
-               rxbp2 = re.compile("^\tstop only if")
+               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]
@@ -101,17 +102,23 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                while i<len(bplines):
                        line = bplines[i]
 
-                       if not rxbp1.search(line):
+                       if not rxbp.search(line):
                                i += 1
                                continue
+       
+                       #Get number of breakpoint
+                       no = string.split(line)[0]
 
-                       splits = string.split(line)
-                       no = splits[0]
-                       pos = splits[-1]
+                       #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 rxbp2.search(bplines[i+1]):
+                       if i+1<len(bplines) and rxcond.search(bplines[i+1]):
                                i +=1
                                line = bplines[i]
                                pre,cond = string.split(line,"if")
@@ -141,16 +148,20 @@ class GdbTerminal (DbgTerminal.DbgTerminal):
                return string.join(split[1:], "=").strip()
 
 
-       def waitForActivation(self, his=None):
+       def waitForActivation(self, starthis=None):
+
+               if starthis == None:
+                       starthis = self.getHistoryLen()
 
                self.setActive(False)
                rx = re.compile("^\(gdb\) $")
-               his, reponse = self.waitForRx(rx,his)
+               endhis, reponse = self.waitForRx(rx,starthis)
                self.setActive(True)
 
-               if self.history[his-1][0:2]=="\x1a\x1a":
-                       tuples = string.split(self.history[his-1][2:], ":")
-                       return tuples[0:2]
+               for his in reversed(range(starthis+1,endhis)):
+                       if self.history[his][0:2]=="\x1a\x1a":
+                               tuples = string.split(self.history[his][2:], ":")
+                               return tuples[0:2]
 
                return None
 
index d61c4f1fddff74700fd039f62cc501073c70c342..872db2374769ecc3019122d3190e73eebacf6117 100644 (file)
--- a/pygdb.vim
+++ b/pygdb.vim
@@ -132,10 +132,8 @@ def gdbGetBreakpoint(file, lineno):
 >>
 
 
-highlight ExecutionLine term=bold ctermbg=DarkGreen ctermfg=White
 highlight BreakPoint term=inverse ctermbg=DarkCyan ctermfg=Black
 
-sign define ExecutionLine text==> texthl=ExecutionLine linehl=ExecutionLine
 sign define BreakPoint text=! texthl=BreakPoint linehl=BreakPoint
 sign define CondBreakPoint text=? texthl=BreakPoint linehl=BreakPoint