From eecfb9274807575485f05200dd73b413613c8eb0 Mon Sep 17 00:00:00 2001 From: ishell Date: Fri, 9 Jan 2015 03:52:17 -0800 Subject: [PATCH] Extend grokdump's dd command with a second optional parameter defining number of words to dump. Review URL: https://codereview.chromium.org/845713002 Cr-Commit-Position: refs/heads/master@{#26007} --- tools/grokdump.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/grokdump.py b/tools/grokdump.py index 2177ec2..5a5cf4b 100755 --- a/tools/grokdump.py +++ b/tools/grokdump.py @@ -2807,16 +2807,20 @@ class InspectionShell(cmd.Cmd): else: print "%s\n" % string - def do_dd(self, address): + def do_dd(self, args): """ - Interpret memory at the given address (if available) as a sequence - of words. Automatic alignment is not performed. + Interpret memory in the given region [address, address + num * word_size) + (if available) as a sequence of words. Automatic alignment is not performed. + If the num is not specified, a default value of 16 words is used. + Synopsis: dd 0x
0x """ - start = int(address, 16) + args = args.split(' ') + start = int(args[0], 16) + num = int(args[1], 16) if len(args) > 1 else 0x10 if (start & self.heap.ObjectAlignmentMask()) != 0: print "Warning: Dumping un-aligned memory, is this what you had in mind?" for slot in xrange(start, - start + self.reader.PointerSize() * 10, + start + self.reader.PointerSize() * num, self.reader.PointerSize()): if not self.reader.IsValidAddress(slot): print "Address is not contained within the minidump!" -- 2.7.4