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