OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 936 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
937 exit(0); | 937 exit(0); |
938 } else { | 938 } else { |
939 PrintUsage(); | 939 PrintUsage(); |
940 exit(kErrorExitCode); | 940 exit(kErrorExitCode); |
941 } | 941 } |
942 } | 942 } |
943 | 943 |
944 if (!DartUtils::SetOriginalWorkingDirectory()) { | 944 if (!DartUtils::SetOriginalWorkingDirectory()) { |
945 OSError err; | 945 OSError err; |
946 fprintf(stderr, "Error determinig current directory: %s\n", err.message()); | 946 fprintf(stderr, "Error determining current directory: %s\n", err.message()); |
947 fflush(stderr); | 947 fflush(stderr); |
948 exit(kErrorExitCode); | 948 exit(kErrorExitCode); |
949 } | 949 } |
950 | 950 |
951 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 951 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
952 | 952 |
953 // Initialize the Dart VM. | 953 // Initialize the Dart VM. |
954 if (!Dart_Initialize(CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, | 954 if (!Dart_Initialize(CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, |
955 DartUtils::OpenFile, | 955 DartUtils::OpenFile, |
956 DartUtils::ReadFile, | 956 DartUtils::ReadFile, |
(...skipping 15 matching lines...) Expand all Loading... |
972 Log::Print("Debugger listening on port %d\n", debug_port); | 972 Log::Print("Debugger listening on port %d\n", debug_port); |
973 } | 973 } |
974 } | 974 } |
975 | 975 |
976 // Start event handler. | 976 // Start event handler. |
977 EventHandler::Start(); | 977 EventHandler::Start(); |
978 | 978 |
979 ASSERT(Dart_CurrentIsolate() == NULL); | 979 ASSERT(Dart_CurrentIsolate() == NULL); |
980 // Start the VM service isolate, if necessary. | 980 // Start the VM service isolate, if necessary. |
981 if (start_vm_service) { | 981 if (start_vm_service) { |
| 982 if (!start_debugger) { |
| 983 DebuggerConnectionHandler::InitForVmService(); |
| 984 } |
982 ASSERT(vm_service_server_ip != NULL && vm_service_server_port >= 0); | 985 ASSERT(vm_service_server_ip != NULL && vm_service_server_port >= 0); |
983 bool r = VmService::Start(vm_service_server_ip , vm_service_server_port); | 986 bool r = VmService::Start(vm_service_server_ip , vm_service_server_port); |
984 if (!r) { | 987 if (!r) { |
985 Log::PrintErr("Could not start VM Service isolate %s\n", | 988 Log::PrintErr("Could not start VM Service isolate %s\n", |
986 VmService::GetErrorMessage()); | 989 VmService::GetErrorMessage()); |
987 } | 990 } |
988 Dart_RegisterIsolateServiceRequestCallback( | 991 Dart_RegisterIsolateServiceRequestCallback( |
989 "io", &ServiceRequestHandler, NULL); | 992 "io", &ServiceRequestHandler, NULL); |
990 } | 993 } |
991 ASSERT(Dart_CurrentIsolate() == NULL); | 994 ASSERT(Dart_CurrentIsolate() == NULL); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 exit(Process::GlobalExitCode()); | 1135 exit(Process::GlobalExitCode()); |
1133 } | 1136 } |
1134 | 1137 |
1135 } // namespace bin | 1138 } // namespace bin |
1136 } // namespace dart | 1139 } // namespace dart |
1137 | 1140 |
1138 int main(int argc, char** argv) { | 1141 int main(int argc, char** argv) { |
1139 dart::bin::main(argc, argv); | 1142 dart::bin::main(argc, argv); |
1140 UNREACHABLE(); | 1143 UNREACHABLE(); |
1141 } | 1144 } |
OLD | NEW |