17 class GdbTerminal (DbgTerminal
.DbgTerminal
):
20 def __init__(self
, clientCmd
):
21 DbgTerminal
.DbgTerminal
.__init
__(self
, clientCmd
)
24 return ["gdb", "--fullname", string
.split(self
.clientCmd
)[0]]
26 def setPty(self
, pty
):
27 ttyname
= os
.ttyname(pty
)
28 self
.feed_dbg("set inferior-tty %s\n" % (ttyname
,))
32 his
= self
.getHistoryLen()
33 argv
= string
.join(string
.split(self
.clientCmd
)[1:])
34 self
.feed_dbg("run " + argv
+ "\n")
35 return self
.waitForActivation(his
)
38 def setContinue(self
):
39 his
= self
.getHistoryLen()
40 self
.feed_dbg("cont\n");
41 return self
.waitForActivation(his
)
43 def setStepover(self
):
44 his
= self
.getHistoryLen()
45 self
.feed_dbg("next\n");
46 return self
.waitForActivation(his
)
49 his
= self
.getHistoryLen()
50 self
.feed_dbg("step\n");
51 return self
.waitForActivation(his
)
54 self
.feed_dbg("quit\n")
58 def setBreakpoint(self
, file, lineno
):
59 self
.feed_dbg("break %s:%d\n" % (file, lineno
))
61 def getExpression(self
, expr
):
63 his
= self
.getHistoryLen()
64 self
.feed_dbg("print " + expr
+ "\n")
66 rx
= re
.compile("^\(gdb\) $")
67 his
, response
= self
.waitForRx(rx
, his
)
69 answer
= self
.history
[his
-1]
71 if len(string
.split(answer
, "=")) == 1:
74 split
= string
.split(answer
, "=")
75 return string
.join(split
[1:], "=").strip()
78 def waitForActivation(self
, his
):
81 rx
= re
.compile("^\(gdb\) $")
82 his
, reponse
= self
.waitForRx(rx
,his
)
85 if self
.history
[his
-1][0:2]=="\x1a\x1a":
86 tuples
= string
.split(self
.history
[his
-1][2:], ":")
93 if __name__
== "__main__":
96 dbgterm
= GdbTerminal(string
.join(sys
.argv
[1:]))
97 dbgwnd
= DbgTerminal
.DbgWindow(dbgterm
)
99 DbgTerminal
.launchDebugger(dbgwnd
, dbgterm
)