Reviewers: Michael Starzinger,

Description:
Add -d flag to grokdump to dump all available memory areas
from the minidump.

Please review this at https://chromiumcodereview.appspot.com/10332137/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     tools/grokdump.py


Index: tools/grokdump.py
===================================================================
--- tools/grokdump.py   (revision 11539)
+++ tools/grokdump.py   (working copy)
@@ -108,6 +108,24 @@
     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 @@
     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 @@
     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 @@
 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()


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to