Revision: 11981
Author:   [email protected]
Date:     Tue Jul  3 04:56:30 2012
Log:      Add function to grokdump shell to print ASCII string.

[email protected]
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10697067
http://code.google.com/p/v8/source/detail?r=11981

Modified:
 /branches/bleeding_edge/tools/grokdump.py

=======================================
--- /branches/bleeding_edge/tools/grokdump.py   Tue Jun 19 04:41:50 2012
+++ /branches/bleeding_edge/tools/grokdump.py   Tue Jul  3 04:56:30 2012
@@ -1522,6 +1522,24 @@
     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

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

Reply via email to