From d898bded39c0e7e4c750939f02a5688acc1d3e97 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Tue, 7 May 2013 13:24:04 +0000 Subject: [PATCH] Prevent grokdump from crying about invalid input. R=ulan@chromium.org Review URL: https://codereview.chromium.org/14660012 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14572 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- tools/grokdump.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/grokdump.py b/tools/grokdump.py index f3ae8a2..1be5cb8 100755 --- a/tools/grokdump.py +++ b/tools/grokdump.py @@ -2036,17 +2036,24 @@ class InspectionShell(cmd.Cmd): def do_u(self, args): """ - u 0x
0x - Unassemble memory in the region [address, address + size) + Unassemble memory in the region [address, address + size). If the + size is not specified, a default value of 32 bytes is used. + Synopsis: u 0x
0x """ args = args.split(' ') start = int(args[0], 16) - size = int(args[1], 16) + size = int(args[1], 16) if len(args) > 1 else 0x20 + if not self.reader.IsValidAddress(start): + print "Address is not contained within the minidump!" + return lines = self.reader.GetDisasmLines(start, size) for line in lines: print FormatDisasmLine(start, self.heap, line) print + def do_EOF(self, none): + raise KeyboardInterrupt + EIP_PROXIMITY = 64 CONTEXT_FOR_ARCH = { @@ -2131,7 +2138,10 @@ def AnalyzeMinidump(options, minidump_name): FullDump(reader, heap) if options.shell: - InspectionShell(reader, heap).cmdloop("type help to get help") + try: + InspectionShell(reader, heap).cmdloop("type help to get help") + except KeyboardInterrupt: + print "Kthxbye." else: if reader.exception is not None: print "Annotated stack (from exception.esp to bottom):" -- 2.7.4