]> git.sthu.org Git - pygdb.git/commitdiff
moved path-pruning to debugger
authorStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:53:19 +0000 (22:53 +0200)
committerStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:53:19 +0000 (22:53 +0200)
- no path pruning in vim-file
- remove duplicated breakpoints after re-reading from gdb

BreakpointsFrame.py
pygdb.vim

index f6967e093d706e0c5ad43ffe8218815563b109ac..681df451bc62abb19b9713898f47993e9cd25d14 100644 (file)
@@ -115,6 +115,7 @@ class BreakpointsFrame (StatusFrame.StatusFrame):
        def applyConfiguration(self, conf):
                for b in conf.breakpoints:
                        self.addBreakpoint(b["file"], b["lineno"], b["cond"])
+               self.updateValues(None)
 
        def fillConfiguration(self, conf):
                iter = self.model.get_iter_first()
@@ -126,13 +127,26 @@ class BreakpointsFrame (StatusFrame.StatusFrame):
 
 
        def addBreakpointToList(self, no, file, lineno, cond=None):
-               iter = self.model.append()
-               self.model.set(iter, 0, no)
 
                if cond==None:
-                       self.model.set(iter, 1, "%s:%s" % (str(file), str(lineno)))
+                       expr =  "%s:%s" % (str(file), str(lineno))
                else:
-                       self.model.set(iter, 1, "%s:%s if %s" % (str(file), str(lineno), str(cond)))
+                       expr = "%s:%s if %s" % (str(file), str(lineno), str(cond))
+
+               iter = self.model.get_iter_first()
+               while iter != None:
+                       newiter = self.model.iter_next(iter)
+                       #Found a expression which is the same --> remove the breakpoint
+                       if (expr,) == self.model.get(iter,1):
+                               no, = self.model.get(iter,0)
+                               self.debugger.delBreakpoint(no)
+                               return
+                       iter = newiter
+       
+               #Add the entry to the breakpoint list
+               iter = self.model.append()
+               self.model.set(iter, 0, no)     
+               self.model.set(iter, 1, expr)
 
 
        def addBtnClicked(self, btn):
index d0b3e5d2eea938cd09b9251444e54d4ef8849735..d61c4f1fddff74700fd039f62cc501073c70c342 100644 (file)
--- a/pygdb.vim
+++ b/pygdb.vim
@@ -112,8 +112,7 @@ def gdbBreakpointCond(lineno=None, file=None, cond=None):
 
 
 def getCurrentFile():
-       splitted = string.split(vim.current.window.buffer.name, os.sep)
-       return splitted[-1]
+       return vim.current.window.buffer.name