projects
/
pygdb.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rewriting DbgTerminal.contents_changed. Much better now
[pygdb.git]
/
GdbTerminal.py
diff --git
a/GdbTerminal.py
b/GdbTerminal.py
index 7341cae049379a2f9342e887f482f43acef56fdf..f468f89fe1f718fb99e870bf3b21abe0b10ff2b9 100755
(executable)
--- a/
GdbTerminal.py
+++ b/
GdbTerminal.py
@@
-25,10
+25,11
@@
class GdbTerminal (DbgTerminal.DbgTerminal):
def setPty(self, pty):
ttyname = os.ttyname(pty)
def setPty(self, pty):
ttyname = os.ttyname(pty)
+ his = self.getHistoryLen()
self.feed_child("set inferior-tty %s\n" % (ttyname,))
self.feed_child("set inferior-tty %s\n" % (ttyname,))
+ self.waitForActivation(his)
def setRun(self):
def setRun(self):
-
his = self.getHistoryLen()
argv = string.join(string.split(self.clientCmd)[1:])
self.feed_child("run " + argv + "\n")
his = self.getHistoryLen()
argv = string.join(string.split(self.clientCmd)[1:])
self.feed_child("run " + argv + "\n")
@@
-65,30
+66,30
@@
class GdbTerminal (DbgTerminal.DbgTerminal):
rx = re.compile("^Breakpoint |^No |^\(gdb\) ")
his, response = self.waitForRx(rx, his)
rx = re.compile("^Breakpoint |^No |^\(gdb\) ")
his, response = self.waitForRx(rx, his)
- if response[0:10] == "Breakpoint":
- return string.split(response)[1].strip()
+ answer = None
+ if response[0:10] == "Breakpoint":
+ answer = string.split(response)[1].strip()
+
+ #Wants an answer: "No"
if response[0:14] == "No source file":
self.feed_child("n\n");
if response[0:14] == "No source file":
self.feed_child("n\n");
- return None
- #Wait again for gdb
- if response[0:5] != "(gdb)":
- his, response = self.waitForRx(rx,his)
+ #Wait again for (gdb)...
+ self.waitForActivation(his)
- return
None
+ return
answer
def delBreakpoint(self, breakpoint):
def delBreakpoint(self, breakpoint):
+ his = self.getHistoryLen()
self.feed_child("del breakpoint %s\n" % (breakpoint,))
self.feed_child("del breakpoint %s\n" % (breakpoint,))
+ self.waitForActivation(his)
def getBreakpoints(self):
starthis = self.getHistoryLen()
self.feed_child("info breakpoints\n")
def getBreakpoints(self):
starthis = self.getHistoryLen()
self.feed_child("info breakpoints\n")
-
- rx = re.compile("^\(gdb\) ")
- endhis, response = self.waitForRx(rx, starthis)
-
+ endhis, response = self.__waitForPrompt(starthis)
rxbp = re.compile("^\d+\s+breakpoint")
rxpos = re.compile("^.* at \S+:\d+$")
rxbp = re.compile("^\d+\s+breakpoint")
rxpos = re.compile("^.* at \S+:\d+$")
@@
-135,10
+136,7
@@
class GdbTerminal (DbgTerminal.DbgTerminal):
his = self.getHistoryLen()
self.feed_child("print " + expr + "\n")
his = self.getHistoryLen()
self.feed_child("print " + expr + "\n")
-
- rx = re.compile("^\(gdb\) $")
- his, response = self.waitForRx(rx, his)
-
+ his, response = self.__waitForPrompt(his)
answer = self.history[his-1]
if len(string.split(answer, "=")) == 1:
answer = self.history[his-1]
if len(string.split(answer, "=")) == 1:
@@
-148,14
+146,10
@@
class GdbTerminal (DbgTerminal.DbgTerminal):
return string.join(split[1:], "=").strip()
return string.join(split[1:], "=").strip()
- def waitForActivation(self, starthis=None):
-
- if starthis == None:
- starthis = self.getHistoryLen()
+ def waitForActivation(self, starthis):
self.setActive(False)
self.setActive(False)
- rx = re.compile("^\(gdb\) $")
- endhis, reponse = self.waitForRx(rx,starthis)
+ endhis, response = self.__waitForPrompt(starthis)
self.setActive(True)
for his in reversed(range(starthis+1,endhis)):
self.setActive(True)
for his in reversed(range(starthis+1,endhis)):
@@
-166,6
+160,12
@@
class GdbTerminal (DbgTerminal.DbgTerminal):
return None
return None
+ def __waitForPrompt(self, his):
+ rx = re.compile("^\(gdb\) ")
+ return self.waitForRx(rx,his)
+
+
+
if __name__ == "__main__":
if __name__ == "__main__":