OLD | NEW |
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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 # Map* m = Map::cast(o); | 924 # Map* m = Map::cast(o); |
925 # const char* n = ""; | 925 # const char* n = ""; |
926 # intptr_t p = reinterpret_cast<intptr_t>(m) & 0xfffff; | 926 # intptr_t p = reinterpret_cast<intptr_t>(m) & 0xfffff; |
927 # int t = m->instance_type(); | 927 # int t = m->instance_type(); |
928 # ROOT_LIST(ROOT_LIST_CASE) | 928 # ROOT_LIST(ROOT_LIST_CASE) |
929 # STRUCT_LIST(STRUCT_LIST_CASE) | 929 # STRUCT_LIST(STRUCT_LIST_CASE) |
930 # printf(" 0x%05x: (%d, \"%s\"),\n", p, t, n); | 930 # printf(" 0x%05x: (%d, \"%s\"),\n", p, t, n); |
931 # } | 931 # } |
932 # printf("}\n"); | 932 # printf("}\n"); |
933 KNOWN_MAPS = { | 933 KNOWN_MAPS = { |
934 0x08081: (128, "MetaMap"), | 934 0x08081: (134, "ByteArrayMap"), |
935 0x080a9: (166, "FixedArrayMap"), | 935 0x080a9: (128, "MetaMap"), |
936 0x080d1: (130, "OddballMap"), | 936 0x080d1: (130, "OddballMap"), |
937 0x080f9: (166, "FixedCOWArrayMap"), | 937 0x080f9: (68, "AsciiSymbolMap"), |
938 0x08121: (166, "ScopeInfoMap"), | 938 0x08121: (166, "FixedArrayMap"), |
939 0x08149: (132, "HeapNumberMap"), | 939 0x08149: (132, "HeapNumberMap"), |
940 0x08171: (133, "ForeignMap"), | 940 0x08171: (135, "FreeSpaceMap"), |
941 0x08199: (64, "SymbolMap"), | 941 0x08199: (146, "OnePointerFillerMap"), |
942 0x081c1: (68, "AsciiSymbolMap"), | 942 0x081c1: (146, "TwoPointerFillerMap"), |
943 0x081e9: (65, "ConsSymbolMap"), | 943 0x081e9: (131, "GlobalPropertyCellMap"), |
944 0x08211: (69, "ConsAsciiSymbolMap"), | 944 0x08211: (167, "SharedFunctionInfoMap"), |
945 0x08239: (66, "ExternalSymbolMap"), | 945 0x08239: (4, "AsciiStringMap"), |
946 0x08261: (74, "ExternalSymbolWithAsciiDataMap"), | 946 0x08261: (166, "NativeContextMap"), |
947 0x08289: (70, "ExternalAsciiSymbolMap"), | 947 0x08289: (129, "CodeMap"), |
948 0x082b1: (82, "ShortExternalSymbolMap"), | 948 0x082b1: (166, "ScopeInfoMap"), |
949 0x082d9: (90, "ShortExternalSymbolWithAsciiDataMap"), | 949 0x082d9: (166, "FixedCOWArrayMap"), |
950 0x08301: (86, "ShortExternalAsciiSymbolMap"), | 950 0x08301: (145, "FixedDoubleArrayMap"), |
951 0x08329: (0, "StringMap"), | 951 0x08329: (166, "HashTableMap"), |
952 0x08351: (4, "AsciiStringMap"), | 952 0x08351: (0, "StringMap"), |
953 0x08379: (1, "ConsStringMap"), | 953 0x08379: (64, "SymbolMap"), |
954 0x083a1: (5, "ConsAsciiStringMap"), | 954 0x083a1: (1, "ConsStringMap"), |
955 0x083c9: (3, "SlicedStringMap"), | 955 0x083c9: (5, "ConsAsciiStringMap"), |
956 0x083f1: (7, "SlicedAsciiStringMap"), | 956 0x083f1: (3, "SlicedStringMap"), |
957 0x08419: (2, "ExternalStringMap"), | 957 0x08419: (7, "SlicedAsciiStringMap"), |
958 0x08441: (10, "ExternalStringWithAsciiDataMap"), | 958 0x08441: (65, "ConsSymbolMap"), |
959 0x08469: (6, "ExternalAsciiStringMap"), | 959 0x08469: (69, "ConsAsciiSymbolMap"), |
960 0x08491: (18, "ShortExternalStringMap"), | 960 0x08491: (66, "ExternalSymbolMap"), |
961 0x084b9: (26, "ShortExternalStringWithAsciiDataMap"), | 961 0x084b9: (74, "ExternalSymbolWithAsciiDataMap"), |
962 0x084e1: (22, "ShortExternalAsciiStringMap"), | 962 0x084e1: (70, "ExternalAsciiSymbolMap"), |
963 0x08509: (0, "UndetectableStringMap"), | 963 0x08509: (2, "ExternalStringMap"), |
964 0x08531: (4, "UndetectableAsciiStringMap"), | 964 0x08531: (10, "ExternalStringWithAsciiDataMap"), |
965 0x08559: (145, "FixedDoubleArrayMap"), | 965 0x08559: (6, "ExternalAsciiStringMap"), |
966 0x08581: (134, "ByteArrayMap"), | 966 0x08581: (82, "ShortExternalSymbolMap"), |
967 0x085a9: (135, "FreeSpaceMap"), | 967 0x085a9: (90, "ShortExternalSymbolWithAsciiDataMap"), |
968 0x085d1: (144, "ExternalPixelArrayMap"), | 968 0x085d1: (86, "ShortExternalAsciiSymbolMap"), |
969 0x085f9: (136, "ExternalByteArrayMap"), | 969 0x085f9: (18, "ShortExternalStringMap"), |
970 0x08621: (137, "ExternalUnsignedByteArrayMap"), | 970 0x08621: (26, "ShortExternalStringWithAsciiDataMap"), |
971 0x08649: (138, "ExternalShortArrayMap"), | 971 0x08649: (22, "ShortExternalAsciiStringMap"), |
972 0x08671: (139, "ExternalUnsignedShortArrayMap"), | 972 0x08671: (0, "UndetectableStringMap"), |
973 0x08699: (140, "ExternalIntArrayMap"), | 973 0x08699: (4, "UndetectableAsciiStringMap"), |
974 0x086c1: (141, "ExternalUnsignedIntArrayMap"), | 974 0x086c1: (144, "ExternalPixelArrayMap"), |
975 0x086e9: (142, "ExternalFloatArrayMap"), | 975 0x086e9: (136, "ExternalByteArrayMap"), |
976 0x08711: (166, "NonStrictArgumentsElementsMap"), | 976 0x08711: (137, "ExternalUnsignedByteArrayMap"), |
977 0x08739: (143, "ExternalDoubleArrayMap"), | 977 0x08739: (138, "ExternalShortArrayMap"), |
978 0x08761: (129, "CodeMap"), | 978 0x08761: (139, "ExternalUnsignedShortArrayMap"), |
979 0x08789: (131, "GlobalPropertyCellMap"), | 979 0x08789: (140, "ExternalIntArrayMap"), |
980 0x087b1: (146, "OnePointerFillerMap"), | 980 0x087b1: (141, "ExternalUnsignedIntArrayMap"), |
981 0x087d9: (146, "TwoPointerFillerMap"), | 981 0x087d9: (142, "ExternalFloatArrayMap"), |
982 0x08801: (147, "DeclaredAccessorDescriptorMap"), | 982 0x08801: (143, "ExternalDoubleArrayMap"), |
983 0x08829: (148, "DeclaredAccessorInfoMap"), | 983 0x08829: (166, "NonStrictArgumentsElementsMap"), |
984 0x08851: (149, "ExecutableAccessorInfoMap"), | 984 0x08851: (166, "FunctionContextMap"), |
985 0x08879: (150, "AccessorPairMap"), | 985 0x08879: (166, "CatchContextMap"), |
986 0x088a1: (151, "AccessCheckInfoMap"), | 986 0x088a1: (166, "WithContextMap"), |
987 0x088c9: (152, "InterceptorInfoMap"), | 987 0x088c9: (166, "BlockContextMap"), |
988 0x088f1: (153, "CallHandlerInfoMap"), | 988 0x088f1: (166, "ModuleContextMap"), |
989 0x08919: (154, "FunctionTemplateInfoMap"), | 989 0x08919: (166, "GlobalContextMap"), |
990 0x08941: (155, "ObjectTemplateInfoMap"), | 990 0x08941: (168, "JSMessageObjectMap"), |
991 0x08969: (156, "SignatureInfoMap"), | 991 0x08969: (133, "ForeignMap"), |
992 0x08991: (157, "TypeSwitchInfoMap"), | 992 0x08991: (173, "NeanderMap"), |
993 0x089b9: (159, "ScriptMap"), | 993 0x089b9: (158, "AllocationSiteInfoMap"), |
994 0x089e1: (158, "AllocationSiteInfoMap"), | 994 0x089e1: (161, "PolymorphicCodeCacheMap"), |
995 0x08a09: (160, "CodeCacheMap"), | 995 0x08a09: (159, "ScriptMap"), |
996 0x08a31: (161, "PolymorphicCodeCacheMap"), | 996 0x08a31: (173, ""), |
997 0x08a59: (162, "TypeFeedbackInfoMap"), | 997 0x08a59: (173, "ExternalMap"), |
998 0x08a81: (163, "AliasedArgumentsEntryMap"), | 998 0x08a81: (147, "DeclaredAccessorDescriptorMap"), |
999 0x08aa9: (164, "DebugInfoMap"), | 999 0x08aa9: (148, "DeclaredAccessorInfoMap"), |
1000 0x08ad1: (165, "BreakPointInfoMap"), | 1000 0x08ad1: (149, "ExecutableAccessorInfoMap"), |
1001 0x08af9: (166, "HashTableMap"), | 1001 0x08af9: (150, "AccessorPairMap"), |
1002 0x08b21: (166, "FunctionContextMap"), | 1002 0x08b21: (151, "AccessCheckInfoMap"), |
1003 0x08b49: (166, "CatchContextMap"), | 1003 0x08b49: (152, "InterceptorInfoMap"), |
1004 0x08b71: (166, "WithContextMap"), | 1004 0x08b71: (153, "CallHandlerInfoMap"), |
1005 0x08b99: (166, "BlockContextMap"), | 1005 0x08b99: (154, "FunctionTemplateInfoMap"), |
1006 0x08bc1: (166, "ModuleContextMap"), | 1006 0x08bc1: (155, "ObjectTemplateInfoMap"), |
1007 0x08be9: (166, "GlobalContextMap"), | 1007 0x08be9: (156, "SignatureInfoMap"), |
1008 0x08c11: (166, "NativeContextMap"), | 1008 0x08c11: (157, "TypeSwitchInfoMap"), |
1009 0x08c39: (167, "SharedFunctionInfoMap"), | 1009 0x08c39: (160, "CodeCacheMap"), |
1010 0x08c61: (168, "JSMessageObjectMap"), | 1010 0x08c61: (162, "TypeFeedbackInfoMap"), |
1011 0x08c89: (173, "ExternalMap"), | 1011 0x08c89: (163, "AliasedArgumentsEntryMap"), |
1012 0x08cb1: (173, "NeanderMap"), | 1012 0x08cb1: (164, "DebugInfoMap"), |
1013 0x08cd9: (173, ""), | 1013 0x08cd9: (165, "BreakPointInfoMap"), |
1014 } | 1014 } |
1015 | 1015 |
1016 | 1016 |
1017 # List of known V8 objects. Used to determine name for objects that are | 1017 # List of known V8 objects. Used to determine name for objects that are |
1018 # part of the root-set and hence on the first page of various old-space | 1018 # part of the root-set and hence on the first page of various old-space |
1019 # paged. Obtained by adding the code below to an IA32 release build with | 1019 # paged. Obtained by adding the code below to an IA32 release build with |
1020 # enabled snapshots to the end of the Isolate::Init method. | 1020 # enabled snapshots to the end of the Isolate::Init method. |
1021 # | 1021 # |
1022 # #define ROOT_LIST_CASE(type, name, camel_name) \ | 1022 # #define ROOT_LIST_CASE(type, name, camel_name) \ |
1023 # if (o == heap_.name()) n = #camel_name; | 1023 # if (o == heap_.name()) n = #camel_name; |
1024 # OldSpaces spit; | 1024 # OldSpaces spit(heap()); |
1025 # printf("KNOWN_OBJECTS = {\n"); | 1025 # printf("KNOWN_OBJECTS = {\n"); |
1026 # for (PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { | 1026 # for (PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { |
1027 # HeapObjectIterator it(s); | 1027 # HeapObjectIterator it(s); |
1028 # const char* sname = AllocationSpaceName(s->identity()); | 1028 # const char* sname = AllocationSpaceName(s->identity()); |
1029 # for (Object* o = it.Next(); o != NULL; o = it.Next()) { | 1029 # for (Object* o = it.Next(); o != NULL; o = it.Next()) { |
1030 # const char* n = NULL; | 1030 # const char* n = NULL; |
1031 # intptr_t p = reinterpret_cast<intptr_t>(o) & 0xfffff; | 1031 # intptr_t p = reinterpret_cast<intptr_t>(o) & 0xfffff; |
1032 # ROOT_LIST(ROOT_LIST_CASE) | 1032 # ROOT_LIST(ROOT_LIST_CASE) |
1033 # if (n != NULL) { | 1033 # if (n != NULL) { |
1034 # printf(" (\"%s\", 0x%05x): \"%s\",\n", sname, p, n); | 1034 # printf(" (\"%s\", 0x%05x): \"%s\",\n", sname, p, n); |
1035 # } | 1035 # } |
1036 # } | 1036 # } |
1037 # } | 1037 # } |
1038 # printf("}\n"); | 1038 # printf("}\n"); |
1039 KNOWN_OBJECTS = { | 1039 KNOWN_OBJECTS = { |
1040 ("OLD_POINTER_SPACE", 0x08081): "NullValue", | 1040 ("OLD_POINTER_SPACE", 0x08081): "NullValue", |
1041 ("OLD_POINTER_SPACE", 0x08091): "LastScriptId", | 1041 ("OLD_POINTER_SPACE", 0x08091): "UndefinedValue", |
1042 ("OLD_POINTER_SPACE", 0x080a1): "TrueValue", | 1042 ("OLD_POINTER_SPACE", 0x080a1): "InstanceofCacheMap", |
1043 ("OLD_POINTER_SPACE", 0x080b1): "FalseValue", | 1043 ("OLD_POINTER_SPACE", 0x080b1): "TrueValue", |
1044 ("OLD_POINTER_SPACE", 0x080c1): "TheHoleValue", | 1044 ("OLD_POINTER_SPACE", 0x080c1): "FalseValue", |
1045 ("OLD_POINTER_SPACE", 0x080d1): "ArgumentsMarker", | 1045 ("OLD_POINTER_SPACE", 0x080d1): "NoInterceptorResultSentinel", |
1046 ("OLD_POINTER_SPACE", 0x080e1): "NoInterceptorResultSentinel", | 1046 ("OLD_POINTER_SPACE", 0x080e1): "ArgumentsMarker", |
1047 ("OLD_POINTER_SPACE", 0x080f1): "TerminationException", | 1047 ("OLD_POINTER_SPACE", 0x080f1): "NumberStringCache", |
1048 ("OLD_POINTER_SPACE", 0x08101): "PolymorphicCodeCache", | 1048 ("OLD_POINTER_SPACE", 0x088f9): "SingleCharacterStringCache", |
1049 ("OLD_POINTER_SPACE", 0x08121): "NumberStringCache", | 1049 ("OLD_POINTER_SPACE", 0x08b01): "StringSplitCache", |
1050 ("OLD_POINTER_SPACE", 0x08929): "SingleCharacterStringCache", | 1050 ("OLD_POINTER_SPACE", 0x08f09): "RegExpMultipleCache", |
1051 ("OLD_POINTER_SPACE", 0x08b31): "StringSplitCache", | 1051 ("OLD_POINTER_SPACE", 0x09311): "TerminationException", |
1052 ("OLD_POINTER_SPACE", 0x08f39): "RegExpMultipleCache", | 1052 ("OLD_POINTER_SPACE", 0x09321): "MessageListeners", |
1053 ("OLD_DATA_SPACE", 0x08081): "EmptyFixedArray", | 1053 ("OLD_POINTER_SPACE", 0x0933d): "CodeStubs", |
1054 ("OLD_DATA_SPACE", 0x08089): "EmptyDescriptorArray", | 1054 ("OLD_POINTER_SPACE", 0x09fa5): "NonMonomorphicCache", |
1055 ("OLD_DATA_SPACE", 0x08091): "EmptyByteArray", | 1055 ("OLD_POINTER_SPACE", 0x0a5b9): "PolymorphicCodeCache", |
1056 ("OLD_DATA_SPACE", 0x08099): "MinusZeroValue", | 1056 ("OLD_POINTER_SPACE", 0x0a5c1): "NativesSourceCache", |
1057 ("OLD_DATA_SPACE", 0x080a5): "NanValue", | 1057 ("OLD_POINTER_SPACE", 0x0a601): "EmptyScript", |
1058 ("OLD_DATA_SPACE", 0x080b1): "InfinityValue", | 1058 ("OLD_POINTER_SPACE", 0x0a63d): "IntrinsicFunctionNames", |
1059 ("OLD_DATA_SPACE", 0x08185): "EmptyString", | 1059 ("OLD_POINTER_SPACE", 0x0d659): "ObservationState", |
1060 ("CODE_SPACE", 0x0a001): "JsEntryCode", | 1060 ("OLD_POINTER_SPACE", 0x27415): "SymbolTable", |
1061 ("CODE_SPACE", 0x0a0e1): "JsConstructEntryCode", | 1061 ("OLD_DATA_SPACE", 0x08099): "EmptyDescriptorArray", |
| 1062 ("OLD_DATA_SPACE", 0x080a1): "EmptyFixedArray", |
| 1063 ("OLD_DATA_SPACE", 0x080a9): "NanValue", |
| 1064 ("OLD_DATA_SPACE", 0x08125): "EmptyByteArray", |
| 1065 ("OLD_DATA_SPACE", 0x0812d): "EmptyString", |
| 1066 ("OLD_DATA_SPACE", 0x08259): "InfinityValue", |
| 1067 ("OLD_DATA_SPACE", 0x08265): "MinusZeroValue", |
| 1068 ("OLD_DATA_SPACE", 0x08271): "PrototypeAccessors", |
| 1069 ("CODE_SPACE", 0x0aea1): "JsEntryCode", |
| 1070 ("CODE_SPACE", 0x0b5c1): "JsConstructEntryCode", |
1062 } | 1071 } |
1063 | 1072 |
1064 | 1073 |
1065 class Printer(object): | 1074 class Printer(object): |
1066 """Printer with indentation support.""" | 1075 """Printer with indentation support.""" |
1067 | 1076 |
1068 def __init__(self): | 1077 def __init__(self): |
1069 self.indent = 0 | 1078 self.indent = 0 |
1070 | 1079 |
1071 def Indent(self): | 1080 def Indent(self): |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 options, args = parser.parse_args() | 1930 options, args = parser.parse_args() |
1922 if os.path.exists(options.objdump): | 1931 if os.path.exists(options.objdump): |
1923 disasm.OBJDUMP_BIN = options.objdump | 1932 disasm.OBJDUMP_BIN = options.objdump |
1924 OBJDUMP_BIN = options.objdump | 1933 OBJDUMP_BIN = options.objdump |
1925 else: | 1934 else: |
1926 print "Cannot find %s, falling back to default objdump" % options.objdump | 1935 print "Cannot find %s, falling back to default objdump" % options.objdump |
1927 if len(args) != 1: | 1936 if len(args) != 1: |
1928 parser.print_help() | 1937 parser.print_help() |
1929 sys.exit(1) | 1938 sys.exit(1) |
1930 AnalyzeMinidump(options, args[0]) | 1939 AnalyzeMinidump(options, args[0]) |
OLD | NEW |