OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/service.h" | 5 #include "vm/service.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/coverage.h" | 10 #include "vm/coverage.h" |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 PrintError(js, "Command too long"); | 1050 PrintError(js, "Command too long"); |
1051 return true; | 1051 return true; |
1052 } | 1052 } |
1053 } else { | 1053 } else { |
1054 PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1)); | 1054 PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1)); |
1055 return true; | 1055 return true; |
1056 } | 1056 } |
1057 } | 1057 } |
1058 | 1058 |
1059 | 1059 |
1060 static bool HandleCpu(Isolate* isolate, JSONStream* js) { | |
1061 JSONObject jsobj(js); | |
1062 jsobj.AddProperty("type", "CPU"); | |
1063 jsobj.AddProperty("targetCPU", CPU::Id()); | |
1064 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | |
1065 return true; | |
1066 } | |
1067 | |
1068 | |
1069 static bool HandleCode(Isolate* isolate, JSONStream* js) { | 1060 static bool HandleCode(Isolate* isolate, JSONStream* js) { |
1070 REQUIRE_COLLECTION_ID("code"); | 1061 REQUIRE_COLLECTION_ID("code"); |
1071 uintptr_t pc; | 1062 uintptr_t pc; |
1072 if (!GetUnsignedIntegerId(js->GetArgument(1), &pc, 16)) { | 1063 if (!GetUnsignedIntegerId(js->GetArgument(1), &pc, 16)) { |
1073 PrintError(js, "Must specify code address: code/c0deadd0."); | 1064 PrintError(js, "Must specify code address: code/c0deadd0."); |
1074 return true; | 1065 return true; |
1075 } | 1066 } |
1076 Code& code = Code::Handle(Code::LookupCode(pc)); | 1067 Code& code = Code::Handle(Code::LookupCode(pc)); |
1077 if (code.IsNull()) { | 1068 if (code.IsNull()) { |
1078 PrintError(js, "Could not find code at %" Px "", pc); | 1069 PrintError(js, "Could not find code at %" Px "", pc); |
(...skipping 21 matching lines...) Expand all Loading... |
1100 } | 1091 } |
1101 | 1092 |
1102 | 1093 |
1103 static IsolateMessageHandlerEntry isolate_handlers[] = { | 1094 static IsolateMessageHandlerEntry isolate_handlers[] = { |
1104 { "_echo", HandleIsolateEcho }, | 1095 { "_echo", HandleIsolateEcho }, |
1105 { "", HandleIsolate }, | 1096 { "", HandleIsolate }, |
1106 { "allocationprofile", HandleAllocationProfile }, | 1097 { "allocationprofile", HandleAllocationProfile }, |
1107 { "classes", HandleClasses }, | 1098 { "classes", HandleClasses }, |
1108 { "code", HandleCode }, | 1099 { "code", HandleCode }, |
1109 { "coverage", HandleCoverage }, | 1100 { "coverage", HandleCoverage }, |
1110 { "cpu", HandleCpu }, | |
1111 { "debug", HandleDebug }, | 1101 { "debug", HandleDebug }, |
1112 { "libraries", HandleLibraries }, | 1102 { "libraries", HandleLibraries }, |
1113 { "objecthistogram", HandleObjectHistogram}, | 1103 { "objecthistogram", HandleObjectHistogram}, |
1114 { "objects", HandleObjects }, | 1104 { "objects", HandleObjects }, |
1115 { "profile", HandleProfile }, | 1105 { "profile", HandleProfile }, |
1116 { "scripts", HandleScripts }, | 1106 { "scripts", HandleScripts }, |
1117 { "stacktrace", HandleStackTrace }, | 1107 { "stacktrace", HandleStackTrace }, |
1118 }; | 1108 }; |
1119 | 1109 |
1120 | 1110 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 for (intptr_t i = 0; i < num_message_handlers; i++) { | 1203 for (intptr_t i = 0; i < num_message_handlers; i++) { |
1214 const RootMessageHandlerEntry& entry = root_handlers[i]; | 1204 const RootMessageHandlerEntry& entry = root_handlers[i]; |
1215 if (!strcmp(command, entry.command)) { | 1205 if (!strcmp(command, entry.command)) { |
1216 return entry.handler; | 1206 return entry.handler; |
1217 } | 1207 } |
1218 } | 1208 } |
1219 return NULL; | 1209 return NULL; |
1220 } | 1210 } |
1221 | 1211 |
1222 } // namespace dart | 1212 } // namespace dart |
OLD | NEW |