]> git.sthu.org Git - pygdb.git/commitdiff
- adapted pygdb.vim
authorStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:05:27 +0000 (22:05 +0200)
committerStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:05:27 +0000 (22:05 +0200)
- fixed regex for paths of breakpoints

BreakpointsFrame.py
Configuration.py
pygdb.vim

index 1a24574423477034bbcee8dbdc39139c8828f8e7..f6967e093d706e0c5ad43ffe8218815563b109ac 100644 (file)
@@ -143,7 +143,7 @@ class BreakpointsFrame (StatusFrame.StatusFrame):
 
                bpspec = self.bpEntry.get_text()
                bpspec = bpspec.strip()
-               rx = re.compile("^[\w\._\-]+:\d+(\s+if\s+\S+.*)?$")
+               rx = re.compile("^[\w/\._\-]+:\d+(\s+if\s+\S+.*)?$")
 
                #Check if format is correct
                if not rx.search(bpspec):
index e3ee6647950b74d6b7efd58166ecf6f0fcca7889..1aeb258a48320eeeb1b27d190fa6aeb6310cd068 100755 (executable)
@@ -22,7 +22,8 @@ class Configuration:
                try:
                        cnt = 0
                        #Parse all lines
-                       for line in file(filename).readlines():
+                       f = file(filename, "r")
+                       for line in f.readlines():
                                cnt += 1
 
                                #Get command and tail
@@ -38,30 +39,38 @@ class Configuration:
                                else:
                                        cnt -= 1
                                        print "Unkown command", cmd
+                       f.close()
                        return cnt
+
                except IOError:
                        return None
 
 
        def store(self, filename):
+               try:
+                       f = file(filename, "w")
 
-               f = file(filename, "w")
+                       for b in self.breakpoints:
+                               self.__writeBreak(f, b)
 
-               for b in self.breakpoints:
-                       self.__writeBreak(f, b)
+                       for w in self.watches:
+                               self.__writeWatch(f, w)
 
-               for w in self.watches:
-                       self.__writeWatch(f, w)
+                       for s in self.ints:
+                               self.__writeInt(f, s)
 
-               for s in self.ints:
-                       self.__writeInt(f, s)
+                       f.close()
+                       return True
+
+               except IOError:
+                       return False
 
 
 
        def parseBreak(self, tail):
 
                tail = tail.strip()
-               rx = re.compile("^[\w\._\-]+:\d+(\s+if\s+\S+.*)?$")
+               rx = re.compile("^[\w/\._\-]+:\d+(\s+if\s+\S+.*)?$")
 
                if not rx.search(tail):
                        print "Wrong breakpoint format:", tail
index b67dd791dbc75626a6e8ee2761253479f63ee66f..80cf77dbda77a47727df8bd5687e5da378a2acdd 100644 (file)
--- a/pygdb.vim
+++ b/pygdb.vim
@@ -16,12 +16,11 @@ import threading
 import vim
 
 #Do not use a ~ for home directory
-sys.path.append("/home/shuber/projekte/pygdb/")
+pygdbdir = "/home/shuber/projekte/pygdb" 
+sys.path.append(pygdbdir)
+
+import Configuration
 
-import pygdb
-import GdbTerminal
-import MainControlWindow
-import StatusWindow
 
 
 #Breakpoint positions: List of dictionaries of form {"signnum" : , "file" : , "lineno":, "cond" : }
@@ -29,13 +28,6 @@ gdbBps = []
 signnum = 0
 clientcmd = ""
 
-gdbterm = None
-mainctrlwnd = None
-statuswnd = None
-gdbthread = None
-
-
-
 def gdbLaunch():
        global gdbterm, mainctrlwnd, statuswnd, gdbBps, clientcmd, gdbthread
 
@@ -47,14 +39,14 @@ def gdbLaunch():
                print "No command given!"
                return
 
-       gdbterm, mainctrlwnd, statuswnd = pygdb.launchDebugger(clientcmd, False)
-
+       #Add the breakpoints to the configuration
+       conf = Configuration.Configuration()
+       conf.load(".pygdb.conf")
        for bp in gdbBps:
-               statuswnd.breakpointsFrame.addBreakpoint(bp["file"], bp["lineno"], bp["cond"])
-
-       print "Started dbg session."
-       gtk.main()
-       print "Finished dbg session."
+               conf.addBreak(bp["file"], bp["lineno"], bp["cond"])
+       conf.store(".pygdb.conf")
+       
+       vim.command("!python %s/pygdb.py %s &\n" % (pygdbdir, clientcmd))
 
 
 def gdbToggleBreakpoint(lineno=None, file=None):