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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 DartUtils::ReadFile, | 1001 DartUtils::ReadFile, |
1002 DartUtils::WriteFile, | 1002 DartUtils::WriteFile, |
1003 DartUtils::CloseFile, | 1003 DartUtils::CloseFile, |
1004 DartUtils::EntropySource, | 1004 DartUtils::EntropySource, |
1005 CreateServiceIsolate)) { | 1005 CreateServiceIsolate)) { |
1006 fprintf(stderr, "%s", "VM initialization failed\n"); | 1006 fprintf(stderr, "%s", "VM initialization failed\n"); |
1007 fflush(stderr); | 1007 fflush(stderr); |
1008 exit(kErrorExitCode); | 1008 exit(kErrorExitCode); |
1009 } | 1009 } |
1010 | 1010 |
| 1011 // Start event handler. |
| 1012 EventHandler::Start(); |
| 1013 |
1011 // Start the debugger wire protocol handler if necessary. | 1014 // Start the debugger wire protocol handler if necessary. |
1012 if (start_debugger) { | 1015 if (start_debugger) { |
1013 ASSERT(debug_port >= 0); | 1016 ASSERT(debug_port >= 0); |
1014 bool print_msg = verbose_debug_seen || (debug_port == 0); | 1017 bool print_msg = verbose_debug_seen || (debug_port == 0); |
1015 debug_port = DebuggerConnectionHandler::StartHandler(debug_ip, debug_port); | 1018 debug_port = DebuggerConnectionHandler::StartHandler(debug_ip, debug_port); |
1016 if (print_msg) { | 1019 if (print_msg) { |
1017 Log::Print("Debugger listening on port %d\n", debug_port); | 1020 Log::Print("Debugger listening on port %d\n", debug_port); |
1018 } | 1021 } |
1019 } | 1022 } |
1020 | 1023 |
1021 // Start event handler. | |
1022 EventHandler::Start(); | |
1023 | |
1024 ASSERT(Dart_CurrentIsolate() == NULL); | 1024 ASSERT(Dart_CurrentIsolate() == NULL); |
1025 // Start the VM service isolate, if necessary. | 1025 // Start the VM service isolate, if necessary. |
1026 if (start_vm_service) { | 1026 if (start_vm_service) { |
1027 if (!start_debugger) { | 1027 if (!start_debugger) { |
1028 DebuggerConnectionHandler::InitForVmService(); | 1028 DebuggerConnectionHandler::InitForVmService(); |
1029 } | 1029 } |
1030 bool r = VmService::Start(vm_service_server_ip, vm_service_server_port); | 1030 bool r = VmService::Start(vm_service_server_ip, vm_service_server_port); |
1031 if (!r) { | 1031 if (!r) { |
1032 Log::PrintErr("Could not start VM Service isolate %s\n", | 1032 Log::PrintErr("Could not start VM Service isolate %s\n", |
1033 VmService::GetErrorMessage()); | 1033 VmService::GetErrorMessage()); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 exit(Process::GlobalExitCode()); | 1179 exit(Process::GlobalExitCode()); |
1180 } | 1180 } |
1181 | 1181 |
1182 } // namespace bin | 1182 } // namespace bin |
1183 } // namespace dart | 1183 } // namespace dart |
1184 | 1184 |
1185 int main(int argc, char** argv) { | 1185 int main(int argc, char** argv) { |
1186 dart::bin::main(argc, argv); | 1186 dart::bin::main(argc, argv); |
1187 UNREACHABLE(); | 1187 UNREACHABLE(); |
1188 } | 1188 } |
OLD | NEW |