From 4269fc84f1e9be0d4fa084728cf17872b1b4b5fa Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Mon, 14 May 2012 07:57:56 +0000 Subject: [PATCH] Add -f or --full flag to grokdump to dump all available memory areas from the minidump. Review URL: https://chromiumcodereview.appspot.com/10332137 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11554 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- tools/grokdump.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/grokdump.py b/tools/grokdump.py index f5df489..29d4755 100755 --- a/tools/grokdump.py +++ b/tools/grokdump.py @@ -108,6 +108,24 @@ class Descriptor(object): return Raw +def do_dump(reader, heap): + """Dump all available memory regions.""" + def dump_region(reader, start, size, location): + print "%s - %s" % (reader.FormatIntPtr(start), + reader.FormatIntPtr(start + size)) + for slot in xrange(start, + start + size, + reader.PointerSize()): + maybe_address = reader.ReadUIntPtr(slot) + heap_object = heap.FindObject(maybe_address) + print "%s: %s" % (reader.FormatIntPtr(slot), + reader.FormatIntPtr(maybe_address)) + if heap_object: + heap_object.Print(Printer()) + print + + reader.ForEachMemoryRegion(dump_region) + # Set of structures and constants that describe the layout of minidump # files. Based on MSDN and Google Breakpad. @@ -774,7 +792,10 @@ class ConsString(String): self.right = self.ObjectField(self.RightOffset()) def GetChars(self): - return self.left.GetChars() + self.right.GetChars() + try: + return self.left.GetChars() + self.right.GetChars() + except: + return "***CAUGHT EXCEPTION IN GROKDUMP***" class Oddball(HeapObject): @@ -1110,6 +1131,9 @@ def AnalyzeMinidump(options, minidump_name): print FormatDisasmLine(start, heap, line) print + if options.full: + do_dump(reader, heap) + if options.shell: InspectionShell(reader, heap).cmdloop("type help to get help") else: @@ -1129,6 +1153,7 @@ def AnalyzeMinidump(options, minidump_name): if __name__ == "__main__": parser = optparse.OptionParser(USAGE) parser.add_option("-s", "--shell", dest="shell", action="store_true") + parser.add_option("-f", "--full", dest="full", action="store_true") options, args = parser.parse_args() if len(args) != 1: parser.print_help() -- 2.7.4