X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=DbgTerminal.py;h=5c5cbd2968e0c7ae1de392087f857e5f2a7aa5b2;hb=382465d6c2f07b99c0263314405d1d8411072d23;hp=afeca3de2d2cf1cccbddbbc3c0477d661782c056;hpb=3c94180482e4ccd256f087ff182278f083a94276;p=pygdb.git diff --git a/DbgTerminal.py b/DbgTerminal.py index afeca3d..5c5cbd2 100644 --- a/DbgTerminal.py +++ b/DbgTerminal.py @@ -62,6 +62,24 @@ class DbgTerminal (vte.Terminal): os.kill(self.childpid, 15); self.childpid = None + def getClientExecuteable(self): + return string.split(self.clientCmd)[0] + + + def toAbsPath(self, path): + """convert path to an absolute path relative to the client + executable we debug.""" + + #Current working dir + pwd = os.getcwd() + "/" + + #executeable path + client = self.getClientExecuteable() + client = relToAbsPath(pwd, client) + + return relToAbsPath(client, path) + + def checkActivityChanged(self): try: @@ -196,6 +214,9 @@ class DbgTerminal (vte.Terminal): def listCodeSnippet(self): raise NotImplementedError() + def getBacktrace(self): + raise NotImplementedError() + def waitForPrompt(self, his): raise NotImplementedError() @@ -220,6 +241,29 @@ def quitHandler(*w): pass +def updateVim(): + os.system('gvim --servername pygdb --remote-send " :GDBLoadConfig"') + + +def relToAbsPath(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) + class DbgWindow (gtk.Window):