import vim
import Configuration
+import DbgTerminal
execsign = None
def gdbLaunch():
- global gdbterm, mainctrlwnd, statuswnd, gdbBps, clientcmd, gdbthread
+ global gdbBps, clientcmd
clientcmd = vim.eval("input('Client commando: ', '%s')" % clientcmd).strip()
#Add the breakpoints to the configuration
conf = Configuration.Configuration()
conf.load(".pygdb.conf")
+ conf.breakpoints = []
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))
+ vim.command("!python %s/pygdb.py --vim-servername %s %s &\n" % (pygdbdir, vim.eval("v:servername"), clientcmd))
def gdbToggleBreakpoint(lineno=None, file=None):
print "%(file)s:%(lineno)d" % bp
-def getAbsPath(absfile, relfile):
- """When an absfile is given and a relfile is given by
- relative paths relative to absfile, determine the abs
- path of relfile"""
- #Get directories except for "." parts
- relsplit = filter(lambda x: x!=".", string.split(relfile, os.sep))
- #Get the directories of absfile withouth the trailing filename
- abssplit = string.split(absfile, os.sep)[:-1]
-
- #Determine number of ".." and remove them
- up=0
- while relsplit[0] == "..":
- up += 1
- del relsplit[0]
- del abssplit[-1]
-
- return string.join(abssplit + relsplit, os.sep)
-
-
-#Change to absolute path
def toAbsPath(path):
global clientcmd, cmdset
#Get the dirs where executeable is in
relcmd = string.split(clientcmd)[0]
- abscmd = getAbsPath(getCurrentFile(), relcmd)
- path = getAbsPath(abscmd, path)
+ abscmd = DbgTerminal.relToAbsPath(getCurrentFile(), relcmd)
+ path = DbgTerminal.relToAbsPath(abscmd, path)
assert(path[0] == "/")
global clientcmd, gdbBps, cmdset
-
-
#Load configuration
conf = Configuration.Configuration()
conf.load(".pygdb.conf")
for bp in conf.breakpoints:
bp["file"] = toAbsPath( bp["file"] )
addBreakpoint(bp["file"], bp["lineno"], bp["cond"])
+
+ #Set the command from config
+ if conf.getCommand() != None:
+ clientcmd = conf.getCommand()
#Set current execution line
if conf.isCurrposSet():
setExecutionLine(file, conf.currlineno)
else:
delExecutionLine()
+
>>
highlight ExecutionLine term=bold ctermbg=DarkGreen ctermfg=Black guibg=LightGreen guifg=Black