X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=pygdb.vim;h=d0b3e5d2eea938cd09b9251444e54d4ef8849735;hb=e223c49137def4558d633b74b77d885f4a2f4e3a;hp=b38a173115aca00226ac05589e4039b49f6ac3d9;hpb=1094f7f4581a9c0074294004bbd8c934593a54d5;p=pygdb.git diff --git a/pygdb.vim b/pygdb.vim index b38a173..d0b3e5d 100644 --- a/pygdb.vim +++ b/pygdb.vim @@ -9,6 +9,7 @@ let s:ScriptLocation = expand("") python << >> import gtk +import os import string import sys import threading @@ -16,45 +17,38 @@ 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): @@ -64,7 +58,7 @@ 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 ) @@ -92,7 +86,7 @@ def gdbBreakpointCond(lineno=None, file=None, cond=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 ) @@ -117,6 +111,12 @@ def gdbBreakpointCond(lineno=None, file=None, cond=None): gdbBps += [b] +def getCurrentFile(): + splitted = string.split(vim.current.window.buffer.name, os.sep) + return splitted[-1] + + + def gdbNewSignnum(): global signnum signnum += 1