Commit 22b3bf58 authored by vegorov@chromium.org's avatar vegorov@chromium.org

Teach grokdump to print oddball kind when ToString content is not available

R=danno@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10559063

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11856 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0a60da71
...@@ -1051,12 +1051,30 @@ class ConsString(String): ...@@ -1051,12 +1051,30 @@ class ConsString(String):
class Oddball(HeapObject): class Oddball(HeapObject):
# Should match declarations in objects.h
KINDS = [
"False",
"True",
"TheHole",
"Null",
"ArgumentMarker",
"Undefined",
"Other"
]
def ToStringOffset(self): def ToStringOffset(self):
return self.heap.PointerSize() 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): def __init__(self, heap, map, address):
HeapObject.__init__(self, heap, map, address) HeapObject.__init__(self, heap, map, address)
self.to_string = self.ObjectField(self.ToStringOffset()) self.to_string = self.ObjectField(self.ToStringOffset())
self.kind = self.SmiField(self.KindOffset())
def Print(self, p): def Print(self, p):
p.Print(str(self)) p.Print(str(self))
...@@ -1065,7 +1083,10 @@ class Oddball(HeapObject): ...@@ -1065,7 +1083,10 @@ class Oddball(HeapObject):
if self.to_string: if self.to_string:
return "Oddball(%08x, <%s>)" % (self.address, self.to_string.GetChars()) return "Oddball(%08x, <%s>)" % (self.address, self.to_string.GetChars())
else: 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): class FixedArray(HeapObject):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment