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

Side by Side Diff: tools/grokdump.py

Issue 10559063: Teach grokdump to print oddball kind when ToString content is not available (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 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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 String.__init__(self, heap, map, address) 1042 String.__init__(self, heap, map, address)
1043 self.left = self.ObjectField(self.LeftOffset()) 1043 self.left = self.ObjectField(self.LeftOffset())
1044 self.right = self.ObjectField(self.RightOffset()) 1044 self.right = self.ObjectField(self.RightOffset())
1045 1045
1046 def GetChars(self): 1046 def GetChars(self):
1047 try: 1047 try:
1048 return self.left.GetChars() + self.right.GetChars() 1048 return self.left.GetChars() + self.right.GetChars()
1049 except: 1049 except:
1050 return "***CAUGHT EXCEPTION IN GROKDUMP***" 1050 return "***CAUGHT EXCEPTION IN GROKDUMP***"
1051 1051
1052 # Should match declarations in objects.h
1053 ODDBALL_KINDS = [
Michael Starzinger 2012/06/19 11:38:35 Can we move that into the "Oddball" class?
1054 "False",
1055 "True",
1056 "TheHole",
1057 "Null",
1058 "ArgumentMarker",
1059 "Undefined",
1060 "Other"
1061 ]
1052 1062
1053 class Oddball(HeapObject): 1063 class Oddball(HeapObject):
1054 def ToStringOffset(self): 1064 def ToStringOffset(self):
1055 return self.heap.PointerSize() 1065 return self.heap.PointerSize()
1056 1066
1067 def ToNumberOffset(self):
1068 return self.ToStringOffset() + self.heap.PointerSize()
1069
1070 def KindOffset(self):
1071 return self.ToNumberOffset() + self.heap.PointerSize()
1072
1057 def __init__(self, heap, map, address): 1073 def __init__(self, heap, map, address):
1058 HeapObject.__init__(self, heap, map, address) 1074 HeapObject.__init__(self, heap, map, address)
1059 self.to_string = self.ObjectField(self.ToStringOffset()) 1075 self.to_string = self.ObjectField(self.ToStringOffset())
1076 self.kind = self.SmiField(self.KindOffset())
1060 1077
1061 def Print(self, p): 1078 def Print(self, p):
1062 p.Print(str(self)) 1079 p.Print(str(self))
1063 1080
1064 def __str__(self): 1081 def __str__(self):
1065 if self.to_string: 1082 if self.to_string:
1066 return "Oddball(%08x, <%s>)" % (self.address, self.to_string.GetChars()) 1083 return "Oddball(%08x, <%s>)" % (self.address, self.to_string.GetChars())
1067 else: 1084 else:
1068 return "Oddball(%08x, kind=%s)" % (self.address, "???") 1085 kind = "???"
1086 if 0 <= self.kind < len(ODDBALL_KINDS):
1087 kind = ODDBALL_KINDS[self.kind]
1088 return "Oddball(%08x, kind=%s)" % (self.address, kind)
1069 1089
1070 1090
1071 class FixedArray(HeapObject): 1091 class FixedArray(HeapObject):
1072 def LengthOffset(self): 1092 def LengthOffset(self):
1073 return self.heap.PointerSize() 1093 return self.heap.PointerSize()
1074 1094
1075 def ElementsOffset(self): 1095 def ElementsOffset(self):
1076 return self.heap.PointerSize() * 2 1096 return self.heap.PointerSize() * 2
1077 1097
1078 def __init__(self, heap, map, address): 1098 def __init__(self, heap, map, address):
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 parser = optparse.OptionParser(USAGE) 1672 parser = optparse.OptionParser(USAGE)
1653 parser.add_option("-s", "--shell", dest="shell", action="store_true", 1673 parser.add_option("-s", "--shell", dest="shell", action="store_true",
1654 help="start an interactive inspector shell") 1674 help="start an interactive inspector shell")
1655 parser.add_option("-f", "--full", dest="full", action="store_true", 1675 parser.add_option("-f", "--full", dest="full", action="store_true",
1656 help="dump all information contained in the minidump") 1676 help="dump all information contained in the minidump")
1657 options, args = parser.parse_args() 1677 options, args = parser.parse_args()
1658 if len(args) != 1: 1678 if len(args) != 1:
1659 parser.print_help() 1679 parser.print_help()
1660 sys.exit(1) 1680 sys.exit(1)
1661 AnalyzeMinidump(options, args[0]) 1681 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