X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=pygdb.vim;h=fe0626ff04f12b9359f87dbcef63393babe3cb17;hb=d7a00b7d9d8b49655f714abc53361bed08e0355d;hp=b67dd791dbc75626a6e8ee2761253479f63ee66f;hpb=f2698c930f26434a100e0b4c1e4f39291b55b4f9;p=pygdb.git diff --git a/pygdb.vim b/pygdb.vim index b67dd79..fe0626f 100644 --- a/pygdb.vim +++ b/pygdb.vim @@ -9,33 +9,22 @@ let s:ScriptLocation = expand("") 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/") +import Configuration -import pygdb -import GdbTerminal -import MainControlWindow -import StatusWindow -#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 +36,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 +53,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 +81,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 +106,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 @@ -133,10 +127,8 @@ def gdbGetBreakpoint(file, lineno): >> -highlight ExecutionLine term=bold ctermbg=DarkGreen ctermfg=White highlight BreakPoint term=inverse ctermbg=DarkCyan ctermfg=Black -sign define ExecutionLine text==> texthl=ExecutionLine linehl=ExecutionLine sign define BreakPoint text=! texthl=BreakPoint linehl=BreakPoint sign define CondBreakPoint text=? texthl=BreakPoint linehl=BreakPoint