| 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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 PrintError(js, "Command too long"); | 1041 PrintError(js, "Command too long"); |
| 1042 return true; | 1042 return true; |
| 1043 } | 1043 } |
| 1044 } else { | 1044 } else { |
| 1045 PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1)); | 1045 PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1)); |
| 1046 return true; | 1046 return true; |
| 1047 } | 1047 } |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 | 1050 |
| 1051 static bool HandleCpu(Isolate* isolate, JSONStream* js) { |
| 1052 JSONObject jsobj(js); |
| 1053 jsobj.AddProperty("type", "CPU"); |
| 1054 jsobj.AddProperty("targetCPU", CPU::Id()); |
| 1055 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
| 1056 return true; |
| 1057 } |
| 1058 |
| 1059 |
| 1051 static bool HandleCode(Isolate* isolate, JSONStream* js) { | 1060 static bool HandleCode(Isolate* isolate, JSONStream* js) { |
| 1052 REQUIRE_COLLECTION_ID("code"); | 1061 REQUIRE_COLLECTION_ID("code"); |
| 1053 uintptr_t pc; | 1062 uintptr_t pc; |
| 1054 if (!GetUnsignedIntegerId(js->GetArgument(1), &pc, 16)) { | 1063 if (!GetUnsignedIntegerId(js->GetArgument(1), &pc, 16)) { |
| 1055 PrintError(js, "Must specify code address: code/c0deadd0."); | 1064 PrintError(js, "Must specify code address: code/c0deadd0."); |
| 1056 return true; | 1065 return true; |
| 1057 } | 1066 } |
| 1058 Code& code = Code::Handle(Code::LookupCode(pc)); | 1067 Code& code = Code::Handle(Code::LookupCode(pc)); |
| 1059 if (code.IsNull()) { | 1068 if (code.IsNull()) { |
| 1060 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... |
| 1082 } | 1091 } |
| 1083 | 1092 |
| 1084 | 1093 |
| 1085 static IsolateMessageHandlerEntry isolate_handlers[] = { | 1094 static IsolateMessageHandlerEntry isolate_handlers[] = { |
| 1086 { "_echo", HandleIsolateEcho }, | 1095 { "_echo", HandleIsolateEcho }, |
| 1087 { "", HandleIsolate }, | 1096 { "", HandleIsolate }, |
| 1088 { "allocationprofile", HandleAllocationProfile }, | 1097 { "allocationprofile", HandleAllocationProfile }, |
| 1089 { "classes", HandleClasses }, | 1098 { "classes", HandleClasses }, |
| 1090 { "code", HandleCode }, | 1099 { "code", HandleCode }, |
| 1091 { "coverage", HandleCoverage }, | 1100 { "coverage", HandleCoverage }, |
| 1101 { "cpu", HandleCpu }, |
| 1092 { "debug", HandleDebug }, | 1102 { "debug", HandleDebug }, |
| 1093 { "libraries", HandleLibraries }, | 1103 { "libraries", HandleLibraries }, |
| 1094 { "objecthistogram", HandleObjectHistogram}, | 1104 { "objecthistogram", HandleObjectHistogram}, |
| 1095 { "objects", HandleObjects }, | 1105 { "objects", HandleObjects }, |
| 1096 { "profile", HandleProfile }, | 1106 { "profile", HandleProfile }, |
| 1097 { "scripts", HandleScripts }, | 1107 { "scripts", HandleScripts }, |
| 1098 { "stacktrace", HandleStackTrace }, | 1108 { "stacktrace", HandleStackTrace }, |
| 1099 }; | 1109 }; |
| 1100 | 1110 |
| 1101 | 1111 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 while (current != NULL) { | 1318 while (current != NULL) { |
| 1309 if (!strcmp(name, current->name())) { | 1319 if (!strcmp(name, current->name())) { |
| 1310 return current; | 1320 return current; |
| 1311 } | 1321 } |
| 1312 current = current->next(); | 1322 current = current->next(); |
| 1313 } | 1323 } |
| 1314 return NULL; | 1324 return NULL; |
| 1315 } | 1325 } |
| 1316 | 1326 |
| 1317 } // namespace dart | 1327 } // namespace dart |
| OLD | NEW |