- adapted pygdb.vim
[pygdb.git] / pygdb.vim
index 1926f3e60b5406859a794c3719884c46dbc109db..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,27 +28,25 @@ gdbBps = []
 signnum = 0
 clientcmd = ""
 
-gdbterm = None
-mainctrlwnd = None
-statuswnd = None
-gdbthread = None
-
-
-
 def gdbLaunch():
        global gdbterm, mainctrlwnd, statuswnd, gdbBps, clientcmd, gdbthread
 
-       if gdbterm == None:
 
-               clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd)
+       clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd).strip()
 
-               gdbterm, mainctrlwnd, statuswnd = pygdb.launchDebugger(clientcmd, False)
 
-               for bp in gdbBps:
-                       statuswnd.breakpointsFrame.addBreakpoint(bp["file"], bp["lineno"], bp["cond"])
+       if clientcmd.strip()=="":
+               print "No command given!"
+               return
 
-               gtk.main()
-               gdbterm = None  
+       #Add the breakpoints to the configuration
+       conf = Configuration.Configuration()
+       conf.load(".pygdb.conf")
+       for bp in gdbBps:
+               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):