X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=pygdb.vim;h=d61c4f1fddff74700fd039f62cc501073c70c342;hb=cbf061bb713edf755eac6910c0526864754f47a3;hp=244e6322a74d3758d349c64ca16b6a5e4b3c2bd7;hpb=fd54ea4a2710afa2bd51e2b8600c4577bdfccc0d;p=pygdb.git diff --git a/pygdb.vim b/pygdb.vim index 244e632..d61c4f1 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,39 +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 pygdb -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 - clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd) - gdbterm, mainctrlwnd, statuswnd = pygdb.launchDebugger(clientcmd, False) + clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd).strip() - for bp in gdbBps: - statuswnd.breakpointsFrame.addBreakpoint(bp["file"], bp["lineno"], bp["cond"]) - print "Started dbg session." - gtk.main() - print "Finished dbg session." + if clientcmd.strip()=="": + print "No command given!" + return + + #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): @@ -58,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 ) @@ -86,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 ) @@ -111,6 +111,11 @@ def gdbBreakpointCond(lineno=None, file=None, cond=None): gdbBps += [b] +def getCurrentFile(): + return vim.current.window.buffer.name + + + def gdbNewSignnum(): global signnum signnum += 1