X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=pygdb.vim;h=d61c4f1fddff74700fd039f62cc501073c70c342;hb=cbf061bb713edf755eac6910c0526864754f47a3;hp=b67dd791dbc75626a6e8ee2761253479f63ee66f;hpb=f2698c930f26434a100e0b4c1e4f39291b55b4f9;p=pygdb.git diff --git a/pygdb.vim b/pygdb.vim index b67dd79..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,26 +17,19 @@ 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 @@ -47,14 +41,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): @@ -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,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