X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=DbgTerminal.py;h=8beec4652f97750b6a553710185b6c92b5295e37;hb=b029ee3dd1a5a785737e73ac6fc024a58d855104;hp=89659d035628a9fe7a450bffc9e603ff905eceb7;hpb=1094f7f4581a9c0074294004bbd8c934593a54d5;p=pygdb.git diff --git a/DbgTerminal.py b/DbgTerminal.py index 89659d0..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,10 +44,18 @@ class DbgTerminal (vte.Terminal): def initialize(self): - 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): c,r = term.get_cursor_position()