+ self.connect("child-exited", quitHandler)
+ gobject.timeout_add(50, self.checkActivityChanged)
+
+ #font description
+ fontdesc = pango.FontDescription("monospace 9")
+ self.set_font(fontdesc)
+
+
+ def initialize(self):
+ self.childpid = self.fork_command( self.getCommand(), self.getArgv())
+ self.waitForPrompt(0)
+ self.setPty(self.client_ptyslave)
+
+ def stopDbg(self):
+
+ if self.childpid != None:
+ #9=KILL, 15=TERM
+ 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:
+
+ #There was activity
+ if self.activityChanged != None:
+
+ res = self.activityChanged
+ self.activityChanged = None
+
+ status, param = res
+ if self.isActive():
+ print "got active: ", res
+ for cb in self.gotActiveCallback:
+ cb(status, param)
+ else:
+ print "got inactive: ", res
+ for cb in self.gotInactiveCallback:
+ cb(status, param)
+ except Exception, e:
+ print e
+
+ return True
+