projects
/
pygdb.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixing synchro problems and exit status problems
[pygdb.git]
/
DbgTerminal.py
diff --git
a/DbgTerminal.py
b/DbgTerminal.py
index 005661ce3e4aeff79f2bcea9461a8389555e7929..f69d8036fc8e5c3785903acb21f081a823ce268d 100644
(file)
--- a/
DbgTerminal.py
+++ b/
DbgTerminal.py
@@
-9,6
+9,7
@@
import gtk
import os
import pango
import pty
import os
import pango
import pty
+import re
import string
import sys
import time
import string
import sys
import time
@@
-51,7
+52,7
@@
class DbgTerminal (vte.Terminal):
def initialize(self):
self.childpid = self.fork_command( self.getCommand(), self.getArgv())
def initialize(self):
self.childpid = self.fork_command( self.getCommand(), self.getArgv())
- self.waitFor
Activation
(0)
+ self.waitFor
Prompt
(0)
self.setPty(self.client_ptyslave)
def stopDbg(self):
self.setPty(self.client_ptyslave)
def stopDbg(self):
@@
-73,9
+74,11
@@
class DbgTerminal (vte.Terminal):
status, param = res
if self.isActive():
status, param = res
if self.isActive():
+ print "got active: ", res
for cb in self.gotActiveCallback:
cb(status, param)
else:
for cb in self.gotActiveCallback:
cb(status, param)
else:
+ print "got inactive: ", res
for cb in self.gotInactiveCallback:
cb(status, param)
except:
for cb in self.gotInactiveCallback:
cb(status, param)
except:
@@
-89,34
+92,44
@@
class DbgTerminal (vte.Terminal):
assert( self.getHistoryLen()>0 )
c,r = term.get_cursor_position()
assert( self.getHistoryLen()>0 )
c,r = term.get_cursor_position()
- text = self.get_text_range(self.lastr,
self.lastc,r,c-1
,lambda *w:True)
+ text = self.get_text_range(self.lastr,
0,r,c
,lambda *w:True)
self.lastc, self.lastr = c,r
#Remove annoying \n at the end
assert(text[-1] == "\n")
text = text[:-1]
self.lastc, self.lastr = c,r
#Remove annoying \n at the end
assert(text[-1] == "\n")
text = text[:-1]
+
#Get the lines and remove empty lines
lines = string.split(text, "\n")
#Remove the incomplete line
#Get the lines and remove empty lines
lines = string.split(text, "\n")
#Remove the incomplete line
- len = max(0,self.getHistoryLen()
-1
)
- self.history[-1]
+
= lines[0]
+ len = max(0,self.getHistoryLen())
+ self.history[-1] = lines[0]
self.history += lines[1:]
#Check if activity status has been changed
for i in range(len, self.getHistoryLen()):
line = self.history[i]
self.history += lines[1:]
#Check if activity status has been changed
for i in range(len, self.getHistoryLen()):
line = self.history[i]
+
+ res = self.testForInactivity(i)
+ if res != None:
+ while self.activityChanged != None:
+ print "wait for pending activity"
+ gtk.main_iteration()
+
+ self.setActive(False)
+ self.activityChanged = res
res = self.testForActivity(i)
res = self.testForActivity(i)
- if res != None and not self.isActive():
+ if res != None:
+ while self.activityChanged != None:
+ print "wait for pending activity"
+ gtk.main_iteration()
+
self.setActive(True)
self.activityChanged = res
self.setActive(True)
self.activityChanged = res
-
- res = self.testForInactivity(i)
- if res != None and self.isActive():
- self.setActive(False)
- self.activityChanged = res
+
@@
-128,7
+141,9
@@
class DbgTerminal (vte.Terminal):
def getHistoryLen(self):
return len(self.history)
def getHistoryLen(self):
return len(self.history)
- def waitForRx(self, rx, start):
+ def waitForRx(self, pat, start):
+
+ rx = re.compile(pat)
curr = start
while True:
assert( curr>=start )
curr = start
while True:
assert( curr>=start )
@@
-139,7
+154,10
@@
class DbgTerminal (vte.Terminal):
#Do not forget the last line
curr = max(start,self.getHistoryLen()-1)
#Do not forget the last line
curr = max(start,self.getHistoryLen()-1)
- gtk.main_iteration()
+ lr, lc = self.lastr, self.lastc
+
+ while (self.lastr, self.lastc) == (lr,lc):
+ gtk.main_iteration()
def getCommand(self):
def getCommand(self):
@@
-175,7
+193,7
@@
class DbgTerminal (vte.Terminal):
def getExpression(self, expr):
raise NotImplementedError()
def getExpression(self, expr):
raise NotImplementedError()
- def waitFor
Activation(self, his):
+ def waitFor
Prompt(self, his):
raise NotImplementedError()
def testForActivity(self, his):
raise NotImplementedError()
def testForActivity(self, his):