pass
-def updateVim():
- os.system('gvim --servername pygdb --remote-send "<ESC> :GDBLoadConfig<CR>"')
-
-
def relToAbsPath(absfile, relfile):
"""When an absfile is given and a relfile is given by
relative paths relative to absfile, determine the abs
class StatusWindow (gtk.Window):
- def __init__(self, debugger):
+ def __init__(self, debugger, vimservername):
gtk.Window.__init__(self)
+ self.vimservername = vimservername
self.debugger = debugger
self.debugger.gotActiveCallback += [self.updateValues]
self.fillConfiguration(conf)
conf.store(".pygdb.conf")
- DbgTerminal.updateVim()
+ self.updateVim()
+ def updateVim(self):
+
+ os.system('gvim --servername %s --remote-send "<ESC> :GDBLoadConfig<CR>"' % \
+ self.vimservername)
+
- Deactivate breakpoints
Bigger requests:
- - several vim sessions are not possible since servername
- is always the same. --> parametrize servername by vim
- bidirectional, immediate communication with vim:
updating breakpoints when setting in vim.
import StatusWindow
-def launchDebugger(clientCmd):
+
+def getArgs():
+ args = {}
+
+ try:
+
+ i=1
+ while i < len(sys.argv):
+
+ if sys.argv[i] == "--help":
+ args["--help"] = True
+
+ elif sys.argv[i] == "--vim-servername":
+ i += 1
+ args["--vim-servername"] = sys.argv[i]
+
+ else:
+ args["cmd"] = string.join(sys.argv[i:])
+ return args
+
+ i += 1
+
+ except Exception, e:
+ return False
+
+ return args
+
+
+def printHelp(f):
+
+ f.write("""Call pygdb with a specific command to be debugged.
+
+Usage:
+ %s --help
+ %s [--vim-servername NAME] <command>
+
+where <command> is the command to call the client that should
+be debugged.
+
+ --help
+ Print help text.
+
+ --vim-servername NAME
+ The servername of the vim to communicate with
+""" % (sys.argv[0], sys.argv[0]) )
+
+
+
+
+if __name__ == "__main__":
+
+
+ #Get the arguments
+ args = getArgs()
+
+ if args == None:
+ printHelp(sys.stderr)
+ sys.exit(-1)
+
+ if "--help" in args.keys():
+ printHelp(sys.stdout)
+ sys.exit(0)
+
+ if not "cmd" in args.keys():
+ sys.stderr.write("Please give executeable to debug.")
+ sys.exit(-2)
+
+ if "--vim-servername" in args.keys():
+ vimservername = args["--vim-servername"]
+ else:
+ vimservername = "pygdb"
+
+
#Create Terminal
- dbgterm = GdbTerminal.GdbTerminal(clientCmd)
+ dbgterm = GdbTerminal.GdbTerminal(args["cmd"])
#Create windows
mainCtrlWnd = MainControlWindow.MainControlWindow(dbgterm)
- statusWnd = StatusWindow.StatusWindow(dbgterm)
+ statusWnd = StatusWindow.StatusWindow(dbgterm, vimservername)
dbgterm.initialize()
#Load configuration
conf.delCurrpos()
conf.store(".pygdb.conf")
- DbgTerminal.updateVim()
-
-
-
-if __name__ == "__main__":
-
- #Check if enough arguments are given
- if len(sys.argv) <= 1:
- print "Please give executeable to debug."
- sys.exit(-1)
+ statusWnd.updateVim()
- #Create the terminals
- clientCmd = string.join(sys.argv[1:])
- launchDebugger(clientCmd)
execsign = None
def gdbLaunch():
- global gdbterm, mainctrlwnd, statuswnd, gdbBps, clientcmd, gdbthread
+ global gdbBps, clientcmd
clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd).strip()
conf.addBreak(bp["file"], bp["lineno"], bp["cond"])
conf.store(".pygdb.conf")
- vim.command("!python %s/pygdb.py %s &\n" % (pygdbdir, clientcmd))
+ vim.command("!python %s/pygdb.py --vim-servername %s %s &\n" % (pygdbdir, vim.eval("v:servername"), clientcmd))
def gdbToggleBreakpoint(lineno=None, file=None):
setExecutionLine(file, conf.currlineno)
else:
delExecutionLine()
+
>>
highlight ExecutionLine term=bold ctermbg=DarkGreen ctermfg=Black guibg=LightGreen guifg=Black