X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=DbgTerminal.py;h=8beec4652f97750b6a553710185b6c92b5295e37;hb=3f09e7c00c7baa277245cf817bc70ed06fe81b1d;hp=8cdc932abfbeda71402a10a1d0ddd985582e9e75;hpb=cfcc39662a53b6f7a77c7ec8f05478227c5f137f;p=pygdb.git diff --git a/DbgTerminal.py b/DbgTerminal.py index 8cdc932..8beec46 100644 --- a/DbgTerminal.py +++ b/DbgTerminal.py @@ -5,6 +5,7 @@ __author__ = "shuber" import gtk +import os import pango import pty import string @@ -18,15 +19,16 @@ import ClientIOTerminal class DbgTerminal (vte.Terminal): - isactive = True - lastrow = 0 - history = [] - - def __init__(self, clientCmd): vte.Terminal.__init__(self) + #Set members + self.childpid = None + self.history = [] + self.lastrow = 0 + self.isactive = True + #Start debugger self.clientCmd = clientCmd #Open pseudo-terminal where to-be-debugged process reads/writes to @@ -42,9 +44,17 @@ class DbgTerminal (vte.Terminal): def initialize(self): - #Launch debugger - self.fork_command( self.getCommand(), self.getArgv()) + self.childpid = self.fork_command( self.getCommand(), self.getArgv()) self.setPty(self.client_ptyslave) + self.waitForActivation() + + def stopDbg(self): + + if self.childpid != None: + #9=KILL, 15=TERM + os.kill(self.childpid, 15); + self.childpid = None + def contents_changed(self, term):