X-Git-Url: https://git.sthu.org/?p=pygdb.git;a=blobdiff_plain;f=GdbTerminal.py;h=58c3bbe13cdcad7b05ca023d6d172f4a38f938d5;hp=81a6300ca19abafd894007a865b7c47e7e6e9746;hb=HEAD;hpb=ae13f1cd2401475e1fc58be3418fb349cd69fb98 diff --git a/GdbTerminal.py b/GdbTerminal.py index 81a6300..58c3bbe 100644 --- a/GdbTerminal.py +++ b/GdbTerminal.py @@ -36,6 +36,22 @@ class GdbTerminal (DbgTerminal.DbgTerminal): def setStepin(self): self.feed_child("step\n"); + def setStepout(self): + bt = self.getBacktrace() + + if len(bt) < 2: + self.setContinue() + + else: + #Get the second line + sec = bt[1] + + #Check if it is a backtrace line + if re.compile("^#1\s+.*\s\S+:\d+$").search(sec): + pos = string.split(sec)[-1] + self.feed_child("advance %s\n" % pos) + + def setQuit(self): self.feed_child("quit\n") self.waitForNewline() @@ -43,9 +59,7 @@ class GdbTerminal (DbgTerminal.DbgTerminal): def setPty(self, pty): ttyname = os.ttyname(pty) - len = self.getHistoryLen() - self.feed_child("set inferior-tty %s\n" % (ttyname,)) - self.waitForPrompt(len) + self.__getAnswerFromCmd("set inferior-tty %s\n" % (ttyname,)) def setBreakpoint(self, file, lineno, condition=None): his = self.getHistoryLen() @@ -74,62 +88,62 @@ class GdbTerminal (DbgTerminal.DbgTerminal): def delBreakpoint(self, breakpoint): - his = self.getHistoryLen() - self.feed_child("del breakpoint %s\n" % (breakpoint,)) - self.waitForPrompt(his) + self.__getAnswerFromCmd("del breakpoint %s\n" % (breakpoint,)) + def getBreakpoints(self): - starthis = self.getHistoryLen() - self.feed_child("info breakpoints\n") - endhis, response = self.waitForPrompt(starthis) + bplines = self.__getAnswerFromCmd("info breakpoints\n") rxbp = re.compile("^\d+\s+breakpoint") - rxpos = re.compile("^.* at \S+:\d+$") - rxcond = re.compile("^\tstop only if") + rxpos = re.compile("at \S+:\d+$") + rxcond = re.compile("^\s+stop only if") bpnts = [] - bplines = self.history[starthis+1:endhis] - i = 0 - #Parse the resulting lines - while i