Index: tools/grokdump.py |
diff --git a/tools/grokdump.py b/tools/grokdump.py |
index 12ccefdef74b6aa3b72ed01ce63634cc553c0bde..9719376d7f4e559d06f0cb14138273bdcce46b38 100755 |
--- a/tools/grokdump.py |
+++ b/tools/grokdump.py |
@@ -40,7 +40,6 @@ import re |
import struct |
import sys |
import types |
-import v8heapconst |
USAGE="""usage: %prog [OPTIONS] [DUMP-FILE] |
@@ -164,11 +163,6 @@ def FullDump(reader, heap): |
reader.ForEachMemoryRegion(dump_region) |
-# Heap constants generated by 'make grokdump' in v8heapconst module. |
-INSTANCE_TYPES = v8heapconst.INSTANCE_TYPES |
-KNOWN_MAPS = v8heapconst.KNOWN_MAPS |
-KNOWN_OBJECTS = v8heapconst.KNOWN_OBJECTS |
- |
# Set of structures and constants that describe the layout of minidump |
# files. Based on MSDN and Google Breakpad. |
@@ -760,14 +754,6 @@ class MinidumpReader(object): |
elif self.arch == MD_CPU_ARCHITECTURE_X86: |
return self.exception_context.esp |
- def ExceptionFP(self): |
- if self.arch == MD_CPU_ARCHITECTURE_AMD64: |
- return self.exception_context.rbp |
- elif self.arch == MD_CPU_ARCHITECTURE_ARM: |
- return None |
- elif self.arch == MD_CPU_ARCHITECTURE_X86: |
- return self.exception_context.ebp |
- |
def FormatIntPtr(self, value): |
if self.arch == MD_CPU_ARCHITECTURE_AMD64: |
return "%016x" % value |
@@ -848,6 +834,262 @@ class MinidumpReader(object): |
return "%s+0x%x" % (symbol.name, diff) |
+ |
+# List of V8 instance types. Obtained by adding the code below to any .cc file. |
+# |
+# #define DUMP_TYPE(T) printf(" %d: \"%s\",\n", T, #T); |
+# struct P { |
+# P() { |
+# printf("INSTANCE_TYPES = {\n"); |
+# INSTANCE_TYPE_LIST(DUMP_TYPE) |
+# printf("}\n"); |
+# } |
+# }; |
+# static P p; |
+INSTANCE_TYPES = { |
+ 0: "STRING_TYPE", |
+ 4: "ASCII_STRING_TYPE", |
+ 1: "CONS_STRING_TYPE", |
+ 5: "CONS_ASCII_STRING_TYPE", |
+ 3: "SLICED_STRING_TYPE", |
+ 2: "EXTERNAL_STRING_TYPE", |
+ 6: "EXTERNAL_ASCII_STRING_TYPE", |
+ 10: "EXTERNAL_STRING_WITH_ASCII_DATA_TYPE", |
+ 18: "SHORT_EXTERNAL_STRING_TYPE", |
+ 22: "SHORT_EXTERNAL_ASCII_STRING_TYPE", |
+ 26: "SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE", |
+ 64: "INTERNALIZED_STRING_TYPE", |
+ 68: "ASCII_INTERNALIZED_STRING_TYPE", |
+ 65: "CONS_INTERNALIZED_STRING_TYPE", |
+ 69: "CONS_ASCII_INTERNALIZED_STRING_TYPE", |
+ 66: "EXTERNAL_INTERNALIZED_STRING_TYPE", |
+ 70: "EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE", |
+ 74: "EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE", |
+ 82: "SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE", |
+ 86: "SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE", |
+ 90: "SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE", |
+ 128: "SYMBOL_TYPE", |
+ 129: "MAP_TYPE", |
+ 130: "CODE_TYPE", |
+ 131: "ODDBALL_TYPE", |
+ 132: "JS_GLOBAL_PROPERTY_CELL_TYPE", |
+ 133: "HEAP_NUMBER_TYPE", |
+ 134: "FOREIGN_TYPE", |
+ 135: "BYTE_ARRAY_TYPE", |
+ 136: "FREE_SPACE_TYPE", |
+ 137: "EXTERNAL_BYTE_ARRAY_TYPE", |
+ 138: "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE", |
+ 139: "EXTERNAL_SHORT_ARRAY_TYPE", |
+ 140: "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE", |
+ 141: "EXTERNAL_INT_ARRAY_TYPE", |
+ 142: "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE", |
+ 143: "EXTERNAL_FLOAT_ARRAY_TYPE", |
+ 145: "EXTERNAL_PIXEL_ARRAY_TYPE", |
+ 147: "FILLER_TYPE", |
+ 148: "DECLARED_ACCESSOR_DESCRIPTOR_TYPE", |
+ 149: "DECLARED_ACCESSOR_INFO_TYPE", |
+ 150: "EXECUTABLE_ACCESSOR_INFO_TYPE", |
+ 151: "ACCESSOR_PAIR_TYPE", |
+ 152: "ACCESS_CHECK_INFO_TYPE", |
+ 153: "INTERCEPTOR_INFO_TYPE", |
+ 154: "CALL_HANDLER_INFO_TYPE", |
+ 155: "FUNCTION_TEMPLATE_INFO_TYPE", |
+ 156: "OBJECT_TEMPLATE_INFO_TYPE", |
+ 157: "SIGNATURE_INFO_TYPE", |
+ 158: "TYPE_SWITCH_INFO_TYPE", |
+ 159: "ALLOCATION_SITE_INFO_TYPE", |
+ 160: "SCRIPT_TYPE", |
+ 161: "CODE_CACHE_TYPE", |
+ 162: "POLYMORPHIC_CODE_CACHE_TYPE", |
+ 163: "TYPE_FEEDBACK_INFO_TYPE", |
+ 164: "ALIASED_ARGUMENTS_ENTRY_TYPE", |
+ 167: "FIXED_ARRAY_TYPE", |
+ 146: "FIXED_DOUBLE_ARRAY_TYPE", |
+ 168: "SHARED_FUNCTION_INFO_TYPE", |
+ 169: "JS_MESSAGE_OBJECT_TYPE", |
+ 172: "JS_VALUE_TYPE", |
+ 173: "JS_DATE_TYPE", |
+ 174: "JS_OBJECT_TYPE", |
+ 175: "JS_CONTEXT_EXTENSION_OBJECT_TYPE", |
+ 176: "JS_MODULE_TYPE", |
+ 177: "JS_GLOBAL_OBJECT_TYPE", |
+ 178: "JS_BUILTINS_OBJECT_TYPE", |
+ 179: "JS_GLOBAL_PROXY_TYPE", |
+ 180: "JS_ARRAY_TYPE", |
+ 171: "JS_PROXY_TYPE", |
+ 183: "JS_WEAK_MAP_TYPE", |
+ 184: "JS_WEAK_SET_TYPE", |
+ 185: "JS_REGEXP_TYPE", |
+ 186: "JS_FUNCTION_TYPE", |
+ 170: "JS_FUNCTION_PROXY_TYPE", |
+ 165: "DEBUG_INFO_TYPE", |
+ 166: "BREAK_POINT_INFO_TYPE", |
+} |
+ |
+ |
+# List of known V8 maps. Used to determine the instance type and name |
+# for maps that are part of the root-set and hence on the first page of |
+# the map-space. Obtained by adding the code below to an IA32 release |
+# build with enabled snapshots to the end of the Isolate::Init method. |
+# |
+# #define ROOT_LIST_CASE(type, name, camel_name) \ |
+# if (o == heap_.name()) n = #camel_name; |
+# #define STRUCT_LIST_CASE(upper_name, camel_name, name) \ |
+# if (o == heap_.name##_map()) n = #camel_name "Map"; |
+# HeapObjectIterator it(heap_.map_space()); |
+# printf("KNOWN_MAPS = {\n"); |
+# for (Object* o = it.Next(); o != NULL; o = it.Next()) { |
+# Map* m = Map::cast(o); |
+# const char* n = ""; |
+# intptr_t p = reinterpret_cast<intptr_t>(m) & 0xfffff; |
+# int t = m->instance_type(); |
+# ROOT_LIST(ROOT_LIST_CASE) |
+# STRUCT_LIST(STRUCT_LIST_CASE) |
+# printf(" 0x%05x: (%d, \"%s\"),\n", p, t, n); |
+# } |
+# printf("}\n"); |
+KNOWN_MAPS = { |
+ 0x08081: (135, "ByteArrayMap"), |
+ 0x080a9: (129, "MetaMap"), |
+ 0x080d1: (131, "OddballMap"), |
+ 0x080f9: (68, "AsciiInternalizedStringMap"), |
+ 0x08121: (167, "FixedArrayMap"), |
+ 0x08149: (133, "HeapNumberMap"), |
+ 0x08171: (136, "FreeSpaceMap"), |
+ 0x08199: (147, "OnePointerFillerMap"), |
+ 0x081c1: (147, "TwoPointerFillerMap"), |
+ 0x081e9: (132, "GlobalPropertyCellMap"), |
+ 0x08211: (168, "SharedFunctionInfoMap"), |
+ 0x08239: (167, "NativeContextMap"), |
+ 0x08261: (130, "CodeMap"), |
+ 0x08289: (167, "ScopeInfoMap"), |
+ 0x082b1: (167, "FixedCOWArrayMap"), |
+ 0x082d9: (146, "FixedDoubleArrayMap"), |
+ 0x08301: (167, "HashTableMap"), |
+ 0x08329: (128, "SymbolMap"), |
+ 0x08351: (0, "StringMap"), |
+ 0x08379: (4, "AsciiStringMap"), |
+ 0x083a1: (1, "ConsStringMap"), |
+ 0x083c9: (5, "ConsAsciiStringMap"), |
+ 0x083f1: (3, "SlicedStringMap"), |
+ 0x08419: (7, "SlicedAsciiStringMap"), |
+ 0x08441: (2, "ExternalStringMap"), |
+ 0x08469: (10, "ExternalStringWithAsciiDataMap"), |
+ 0x08491: (6, "ExternalAsciiStringMap"), |
+ 0x084b9: (18, "ShortExternalStringMap"), |
+ 0x084e1: (26, "ShortExternalStringWithAsciiDataMap"), |
+ 0x08509: (64, "InternalizedStringMap"), |
+ 0x08531: (65, "ConsInternalizedStringMap"), |
+ 0x08559: (69, "ConsAsciiInternalizedStringMap"), |
+ 0x08581: (66, "ExternalInternalizedStringMap"), |
+ 0x085a9: (74, "ExternalInternalizedStringWithAsciiDataMap"), |
+ 0x085d1: (70, "ExternalAsciiInternalizedStringMap"), |
+ 0x085f9: (82, "ShortExternalInternalizedStringMap"), |
+ 0x08621: (90, "ShortExternalInternalizedStringWithAsciiDataMap"), |
+ 0x08649: (86, "ShortExternalAsciiInternalizedStringMap"), |
+ 0x08671: (22, "ShortExternalAsciiStringMap"), |
+ 0x08699: (0, "UndetectableStringMap"), |
+ 0x086c1: (4, "UndetectableAsciiStringMap"), |
+ 0x086e9: (145, "ExternalPixelArrayMap"), |
+ 0x08711: (137, "ExternalByteArrayMap"), |
+ 0x08739: (138, "ExternalUnsignedByteArrayMap"), |
+ 0x08761: (139, "ExternalShortArrayMap"), |
+ 0x08789: (140, "ExternalUnsignedShortArrayMap"), |
+ 0x087b1: (141, "ExternalIntArrayMap"), |
+ 0x087d9: (142, "ExternalUnsignedIntArrayMap"), |
+ 0x08801: (143, "ExternalFloatArrayMap"), |
+ 0x08829: (144, "ExternalDoubleArrayMap"), |
+ 0x08851: (167, "NonStrictArgumentsElementsMap"), |
+ 0x08879: (167, "FunctionContextMap"), |
+ 0x088a1: (167, "CatchContextMap"), |
+ 0x088c9: (167, "WithContextMap"), |
+ 0x088f1: (167, "BlockContextMap"), |
+ 0x08919: (167, "ModuleContextMap"), |
+ 0x08941: (167, "GlobalContextMap"), |
+ 0x08969: (169, "JSMessageObjectMap"), |
+ 0x08991: (134, "ForeignMap"), |
+ 0x089b9: (174, "NeanderMap"), |
+ 0x089e1: (159, "AllocationSiteInfoMap"), |
+ 0x08a09: (162, "PolymorphicCodeCacheMap"), |
+ 0x08a31: (160, "ScriptMap"), |
+ 0x08a59: (174, ""), |
+ 0x08a81: (174, "ExternalMap"), |
+ 0x08aa9: (148, "DeclaredAccessorDescriptorMap"), |
+ 0x08ad1: (149, "DeclaredAccessorInfoMap"), |
+ 0x08af9: (150, "ExecutableAccessorInfoMap"), |
+ 0x08b21: (151, "AccessorPairMap"), |
+ 0x08b49: (152, "AccessCheckInfoMap"), |
+ 0x08b71: (153, "InterceptorInfoMap"), |
+ 0x08b99: (154, "CallHandlerInfoMap"), |
+ 0x08bc1: (155, "FunctionTemplateInfoMap"), |
+ 0x08be9: (156, "ObjectTemplateInfoMap"), |
+ 0x08c11: (157, "SignatureInfoMap"), |
+ 0x08c39: (158, "TypeSwitchInfoMap"), |
+ 0x08c61: (161, "CodeCacheMap"), |
+ 0x08c89: (163, "TypeFeedbackInfoMap"), |
+ 0x08cb1: (164, "AliasedArgumentsEntryMap"), |
+ 0x08cd9: (165, "DebugInfoMap"), |
+ 0x08d01: (166, "BreakPointInfoMap"), |
+} |
+ |
+ |
+# List of known V8 objects. Used to determine name for objects that are |
+# part of the root-set and hence on the first page of various old-space |
+# paged. Obtained by adding the code below to an IA32 release build with |
+# enabled snapshots to the end of the Isolate::Init method. |
+# |
+# #define ROOT_LIST_CASE(type, name, camel_name) \ |
+# if (o == heap_.name()) n = #camel_name; |
+# OldSpaces spit(heap()); |
+# printf("KNOWN_OBJECTS = {\n"); |
+# for (PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { |
+# HeapObjectIterator it(s); |
+# const char* sname = AllocationSpaceName(s->identity()); |
+# for (Object* o = it.Next(); o != NULL; o = it.Next()) { |
+# const char* n = NULL; |
+# intptr_t p = reinterpret_cast<intptr_t>(o) & 0xfffff; |
+# ROOT_LIST(ROOT_LIST_CASE) |
+# if (n != NULL) { |
+# printf(" (\"%s\", 0x%05x): \"%s\",\n", sname, p, n); |
+# } |
+# } |
+# } |
+# printf("}\n"); |
+KNOWN_OBJECTS = { |
+ ("OLD_POINTER_SPACE", 0x08081): "NullValue", |
+ ("OLD_POINTER_SPACE", 0x08091): "UndefinedValue", |
+ ("OLD_POINTER_SPACE", 0x080a1): "InstanceofCacheMap", |
+ ("OLD_POINTER_SPACE", 0x080b1): "TrueValue", |
+ ("OLD_POINTER_SPACE", 0x080c1): "FalseValue", |
+ ("OLD_POINTER_SPACE", 0x080d1): "NoInterceptorResultSentinel", |
+ ("OLD_POINTER_SPACE", 0x080e1): "ArgumentsMarker", |
+ ("OLD_POINTER_SPACE", 0x080f1): "NumberStringCache", |
+ ("OLD_POINTER_SPACE", 0x088f9): "SingleCharacterStringCache", |
+ ("OLD_POINTER_SPACE", 0x08b01): "StringSplitCache", |
+ ("OLD_POINTER_SPACE", 0x08f09): "RegExpMultipleCache", |
+ ("OLD_POINTER_SPACE", 0x09311): "TerminationException", |
+ ("OLD_POINTER_SPACE", 0x09321): "MessageListeners", |
+ ("OLD_POINTER_SPACE", 0x0933d): "CodeStubs", |
+ ("OLD_POINTER_SPACE", 0x09fa5): "NonMonomorphicCache", |
+ ("OLD_POINTER_SPACE", 0x0a5b9): "PolymorphicCodeCache", |
+ ("OLD_POINTER_SPACE", 0x0a5c1): "NativesSourceCache", |
+ ("OLD_POINTER_SPACE", 0x0a601): "EmptyScript", |
+ ("OLD_POINTER_SPACE", 0x0a63d): "IntrinsicFunctionNames", |
+ ("OLD_POINTER_SPACE", 0x0d659): "ObservationState", |
+ ("OLD_POINTER_SPACE", 0x27415): "SymbolTable", |
+ ("OLD_DATA_SPACE", 0x08099): "EmptyDescriptorArray", |
+ ("OLD_DATA_SPACE", 0x080a1): "EmptyFixedArray", |
+ ("OLD_DATA_SPACE", 0x080a9): "NanValue", |
+ ("OLD_DATA_SPACE", 0x08125): "EmptyByteArray", |
+ ("OLD_DATA_SPACE", 0x0812d): "EmptyString", |
+ ("OLD_DATA_SPACE", 0x08259): "InfinityValue", |
+ ("OLD_DATA_SPACE", 0x08265): "MinusZeroValue", |
+ ("OLD_DATA_SPACE", 0x08271): "PrototypeAccessors", |
+ ("CODE_SPACE", 0x0aea1): "JsEntryCode", |
+ ("CODE_SPACE", 0x0b5c1): "JsConstructEntryCode", |
+} |
+ |
+ |
class Printer(object): |
"""Printer with indentation support.""" |
@@ -1959,15 +2201,11 @@ def AnalyzeMinidump(options, minidump_name): |
print "Kthxbye." |
elif not options.command: |
if reader.exception is not None: |
- frame_pointer = reader.ExceptionFP() |
print "Annotated stack (from exception.esp to bottom):" |
for slot in xrange(stack_top, stack_bottom, reader.PointerSize()): |
maybe_address = reader.ReadUIntPtr(slot) |
heap_object = heap.FindObject(maybe_address) |
maybe_symbol = reader.FindSymbol(maybe_address) |
- if slot == frame_pointer: |
- maybe_symbol = "<---- frame pointer" |
- frame_pointer = maybe_address |
print "%s: %s %s" % (reader.FormatIntPtr(slot), |
reader.FormatIntPtr(maybe_address), |
maybe_symbol or "") |