Reviewers: mstarzing_chromium.org,

Description:
Add function to grokdump shell to print ASCII string.


[email protected]
BUG=
TEST=


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

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

Affected files:
  M tools/grokdump.py


Index: tools/grokdump.py
diff --git a/tools/grokdump.py b/tools/grokdump.py
index 59a2a48716d536af5101f479aeb0032f0b6a7179..e6141be56603ceac513a91508cee2412fcf89459 100755
--- a/tools/grokdump.py
+++ b/tools/grokdump.py
@@ -1591,6 +1591,25 @@ class InspectionShell(cmd.Cmd):
                                       size)
     print "Available memory regions:"
     self.reader.ForEachMemoryRegion(print_region)
+
+  def do_ascii(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" % string


 EIP_PROXIMITY = 64


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

Reply via email to