Add function to grokdump shell to print ASCII string.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 3 Jul 2012 11:56:30 +0000 (11:56 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 3 Jul 2012 11:56:30 +0000 (11:56 +0000)
R=mstarzinger@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10697067

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11981 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/grokdump.py

index 59a2a48716d536af5101f479aeb0032f0b6a7179..24c9c5a92c10202031e974122535a2858077444b 100755 (executable)
@@ -1522,6 +1522,24 @@ class InspectionShell(cmd.Cmd):
     else:
       print "Page header is not available!"
 
+  def do_da(self, address):
+    """
+     Print ASCII string starting at specified address.
+    """
+    address = int(address, 16)
+    string = ""
+    while self.reader.IsValidAddress(address):
+      code = self.reader.ReadU8(address)
+      if code < 128:
+        string += chr(code)
+      else:
+        break
+      address += 1
+    if string == "":
+      print "Not an ASCII string at %s" % self.reader.FormatIntPtr(address)
+    else:
+      print "%s\n" % string
+
   def do_k(self, arguments):
     """
      Teach V8 heap layout information to the inspector. This increases