Overwrite breakpoints when launching pygdb from vim, updating vim also after quit
[pygdb.git] / pygdb.vim
index e505b0aca7c938994a9725403cbce21efa63526f..d7b68e7b94563ced5612f7235fb88179fe412aac 100644 (file)
--- a/pygdb.vim
+++ b/pygdb.vim
@@ -16,6 +16,7 @@ import threading
 import vim
 
 import Configuration
+import DbgTerminal
 
 
 
@@ -38,6 +39,7 @@ def gdbLaunch():
        #Add the breakpoints to the configuration
        conf = Configuration.Configuration()
        conf.load(".pygdb.conf")
+       conf.breakpoints = []
        for bp in gdbBps:
                conf.addBreak(bp["file"], bp["lineno"], bp["cond"])
        conf.store(".pygdb.conf")
@@ -187,27 +189,7 @@ def gdbShowBreakpoints():
                        print "%(file)s:%(lineno)d" % bp
 
 
-def getAbsPath(absfile, relfile):
-       """When an absfile is given and a relfile is given by
-       relative paths relative to absfile, determine the abs
-       path of relfile"""
 
-       #Get directories except for "." parts
-       relsplit = filter(lambda x: x!=".", string.split(relfile, os.sep))
-       #Get the directories of absfile withouth the trailing filename 
-       abssplit = string.split(absfile, os.sep)[:-1]
-
-       #Determine number of ".." and remove them
-       up=0
-       while relsplit[0] == "..":
-               up += 1
-               del relsplit[0]
-               del abssplit[-1]
-
-       return string.join(abssplit + relsplit, os.sep)
-
-
-#Change to absolute path
 def toAbsPath(path):
        global clientcmd, cmdset
 
@@ -221,8 +203,8 @@ def toAbsPath(path):
 
                #Get the dirs where executeable is in
                relcmd = string.split(clientcmd)[0]
-               abscmd = getAbsPath(getCurrentFile(), relcmd)
-               path = getAbsPath(abscmd, path)
+               abscmd = DbgTerminal.relToAbsPath(getCurrentFile(), relcmd)
+               path = DbgTerminal.relToAbsPath(abscmd, path)
 
                assert(path[0] == "/")