X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=GdbTerminal.py;h=81a6300ca19abafd894007a865b7c47e7e6e9746;hb=c1af9e228e978365c751e58aaa49a0879391a101;hp=579849dea5816e2494894c7b606087d4f167d78c;hpb=e8f5eba24b3fd5cdd839bcfc170a2e3aa16dd05d;p=pygdb.git diff --git a/GdbTerminal.py b/GdbTerminal.py old mode 100755 new mode 100644 index 579849d..81a6300 --- a/GdbTerminal.py +++ b/GdbTerminal.py @@ -137,6 +137,15 @@ class GdbTerminal (DbgTerminal.DbgTerminal): split = string.split(answer, "=") return string.join(split[1:], "=").strip() + + def listCodeSnippet(self): + starthis = self.getHistoryLen() + self.feed_child("list\n") + endhis, response = self.waitForPrompt(starthis) + + text = string.join(self.history[starthis:endhis], "\n") + return text + def waitForPrompt(self, his): rx = "^\(gdb\)" @@ -155,11 +164,14 @@ class GdbTerminal (DbgTerminal.DbgTerminal): if string.find(line, "Program exited") == 0: code = string.split(line)[-1] - code = code[1:-1] codeno = 0 - for c in code: - codeno = codeno*8 + int(c) + + #Parse the octal number + if code[0] == "O": + code = code[1:-1] + for c in code: + codeno = codeno*8 + int(c) return "exited", codeno