Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Unified Diff: tools/grokdump.py

Issue 10697067: Add function to grokdump shell to print ASCII string. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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):
Michael Starzinger 2012/07/03 11:43:16 How about naming this command "dascii" or just "da
Yang 2012/07/03 11:51:11 Done.
+ """
+ Print ASCII string starting at specified address.
Michael Starzinger 2012/07/03 11:43:16 Indent that by one space for consistency.
Yang 2012/07/03 11:51:11 Done.
+ """
+ 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
Michael Starzinger 2012/07/03 11:43:16 Maybe we should put parentheses around the string.
Yang 2012/07/03 11:51:11 Quotes don't work that well since the string may n
EIP_PROXIMITY = 64
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698