python << >>
import gtk
+import os
import string
import sys
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 GdbTerminal
-import MainControlWindow
-import StatusWindow
+import Configuration
-#Breakpoint positions: List of dictionaries of form {"signnum" : , "file" : , "lineno":, "cond" : }
+
+#Breakpoint positions: List of dictionaries of form
+#{"signnum" : , "file" : , "lineno":, "cond" : }
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)
- gdbterm = GdbTerminal.GdbTerminal(clientcmd)
- mainctrlwnd = MainControlWindow.MainControlWindow(gdbterm, quitonclose=False)
- statuswnd = StatusWindow.StatusWindow(mainctrlwnd, gdbterm, quitonclose=False)
- gdbterm.initialize()
+ clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd).strip()
- for bp in gdbBps:
- statuswnd.breakpointsFrame.addBreakpoint(bp["file"], bp["lineno"], bp["cond"])
+ if clientcmd.strip()=="":
+ print "No command given!"
+ return
- gtk.main()
- gtk.main()
- print "hello"
- #mainctrlwnd.hide()
- #statuswnd.hide()
+ #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):
if lineno==None:
lineno = vim.current.window.cursor[0]
if file==None:
- file = vim.current.window.buffer.name
+ file = getCurrentFile()
#Determine index of breakpoint
bpidx = gdbGetBreakpoint( file, lineno )
if lineno==None:
lineno = vim.current.window.cursor[0]
if file==None:
- file = vim.current.window.buffer.name
+ file = getCurrentFile()
#Determine index of breakpoint
bpidx = gdbGetBreakpoint( file, lineno )
gdbBps += [b]
+def getCurrentFile():
+ return vim.current.window.buffer.name
+
+
+
def gdbNewSignnum():
global signnum
signnum += 1