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

Unified 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 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 a9f0cb9ddc282c5caab171f69f610720bf27bf15..57751141c0125078b40b78d7f2322c3ea952b72e 100755
--- a/tools/grokdump.py
+++ b/tools/grokdump.py
@@ -1049,14 +1049,31 @@ class ConsString(String):
except:
return "***CAUGHT EXCEPTION IN GROKDUMP***"
+# Should match declarations in objects.h
+ODDBALL_KINDS = [
Michael Starzinger 2012/06/19 11:38:35 Can we move that into the "Oddball" class?
+ "False",
+ "True",
+ "TheHole",
+ "Null",
+ "ArgumentMarker",
+ "Undefined",
+ "Other"
+]
class Oddball(HeapObject):
def ToStringOffset(self):
return self.heap.PointerSize()
+ def ToNumberOffset(self):
+ return self.ToStringOffset() + self.heap.PointerSize()
+
+ def KindOffset(self):
+ return self.ToNumberOffset() + self.heap.PointerSize()
+
def __init__(self, heap, map, address):
HeapObject.__init__(self, heap, map, address)
self.to_string = self.ObjectField(self.ToStringOffset())
+ self.kind = self.SmiField(self.KindOffset())
def Print(self, p):
p.Print(str(self))
@@ -1065,7 +1082,10 @@ class Oddball(HeapObject):
if self.to_string:
return "Oddball(%08x, <%s>)" % (self.address, self.to_string.GetChars())
else:
- return "Oddball(%08x, kind=%s)" % (self.address, "???")
+ kind = "???"
+ if 0 <= self.kind < len(ODDBALL_KINDS):
+ kind = ODDBALL_KINDS[self.kind]
+ return "Oddball(%08x, kind=%s)" % (self.address, kind)
class FixedArray(HeapObject):
« 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