Chromium Code Reviews| 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 |