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

Side by Side 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, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 Interpret memory at the given address as being on a V8 heap page 1515 Interpret memory at the given address as being on a V8 heap page
1516 and print information about the page header (if available). 1516 and print information about the page header (if available).
1517 """ 1517 """
1518 address = int(address, 16) 1518 address = int(address, 16)
1519 page_address = address & ~self.heap.PageAlignmentMask() 1519 page_address = address & ~self.heap.PageAlignmentMask()
1520 if self.reader.IsValidAddress(page_address): 1520 if self.reader.IsValidAddress(page_address):
1521 raise NotImplementedError 1521 raise NotImplementedError
1522 else: 1522 else:
1523 print "Page header is not available!" 1523 print "Page header is not available!"
1524 1524
1525 def do_da(self, address):
1526 """
1527 Print ASCII string starting at specified address.
1528 """
1529 address = int(address, 16)
1530 string = ""
1531 while self.reader.IsValidAddress(address):
1532 code = self.reader.ReadU8(address)
1533 if code < 128:
1534 string += chr(code)
1535 else:
1536 break
1537 address += 1
1538 if string == "":
1539 print "Not an ASCII string at %s" % self.reader.FormatIntPtr(address)
1540 else:
1541 print "%s\n" % string
1542
1525 def do_k(self, arguments): 1543 def do_k(self, arguments):
1526 """ 1544 """
1527 Teach V8 heap layout information to the inspector. This increases 1545 Teach V8 heap layout information to the inspector. This increases
1528 the amount of annotations the inspector can produce while dumping 1546 the amount of annotations the inspector can produce while dumping
1529 data. The first page of each heap space is of particular interest 1547 data. The first page of each heap space is of particular interest
1530 because it contains known objects that do not move. 1548 because it contains known objects that do not move.
1531 """ 1549 """
1532 self.padawan.PrintKnowledge() 1550 self.padawan.PrintKnowledge()
1533 1551
1534 def do_km(self, address): 1552 def do_km(self, address):
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 parser = optparse.OptionParser(USAGE) 1691 parser = optparse.OptionParser(USAGE)
1674 parser.add_option("-s", "--shell", dest="shell", action="store_true", 1692 parser.add_option("-s", "--shell", dest="shell", action="store_true",
1675 help="start an interactive inspector shell") 1693 help="start an interactive inspector shell")
1676 parser.add_option("-f", "--full", dest="full", action="store_true", 1694 parser.add_option("-f", "--full", dest="full", action="store_true",
1677 help="dump all information contained in the minidump") 1695 help="dump all information contained in the minidump")
1678 options, args = parser.parse_args() 1696 options, args = parser.parse_args()
1679 if len(args) != 1: 1697 if len(args) != 1:
1680 parser.print_help() 1698 parser.print_help()
1681 sys.exit(1) 1699 sys.exit(1)
1682 AnalyzeMinidump(options, args[0]) 1700 AnalyzeMinidump(options, args[0])
OLDNEW
« 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