| 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 "bin/dbg_connection.h" | 5 #include "bin/dbg_connection.h" |
| 6 #include "bin/dartutils.h" | 6 #include "bin/dartutils.h" |
| 7 #include "bin/socket.h" | 7 #include "bin/socket.h" |
| 8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 | 10 |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 SendQueuedMsgs(); | 991 SendQueuedMsgs(); |
| 992 SendBreakpointEvent(trace); | 992 SendBreakpointEvent(trace); |
| 993 HandleMessages(); | 993 HandleMessages(); |
| 994 if (!msgbuf_->Alive()) { | 994 if (!msgbuf_->Alive()) { |
| 995 CloseDbgConnection(); | 995 CloseDbgConnection(); |
| 996 } | 996 } |
| 997 Dart_ExitScope(); | 997 Dart_ExitScope(); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 | 1000 |
| 1001 void DebuggerConnectionHandler::IsolateEventHandler(Dart_Isolate isolate, |
| 1002 Dart_IsolateEvent kind) { |
| 1003 WaitForConnection(); |
| 1004 #if 0 |
| 1005 if (kind == kCreated) { |
| 1006 printf("Isolate created %p\n", isolate); |
| 1007 } else if (kind == kInterrupted) { |
| 1008 printf("Isolate interrupted %p\n", isolate); |
| 1009 } else if (kind == kShutdown) { |
| 1010 printf("Isolate shutdown %p\n", isolate); |
| 1011 } |
| 1012 #endif |
| 1013 } |
| 1014 |
| 1015 |
| 1001 void DebuggerConnectionHandler::SendExceptionEvent( | 1016 void DebuggerConnectionHandler::SendExceptionEvent( |
| 1002 Dart_Handle exception, | 1017 Dart_Handle exception, |
| 1003 Dart_StackTrace stack_trace) { | 1018 Dart_StackTrace stack_trace) { |
| 1004 intptr_t exception_id = Dart_CacheObject(exception); | 1019 intptr_t exception_id = Dart_CacheObject(exception); |
| 1005 ASSERT(exception_id >= 0); | 1020 ASSERT(exception_id >= 0); |
| 1006 dart::TextBuffer msg(128); | 1021 dart::TextBuffer msg(128); |
| 1007 msg.Printf("{ \"event\": \"paused\", \"params\": {"); | 1022 msg.Printf("{ \"event\": \"paused\", \"params\": {"); |
| 1008 msg.Printf("\"reason\": \"exception\", "); | 1023 msg.Printf("\"reason\": \"exception\", "); |
| 1009 msg.Printf("\"exception\":"); | 1024 msg.Printf("\"exception\":"); |
| 1010 FormatRemoteObj(&msg, exception); | 1025 FormatRemoteObj(&msg, exception); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 void DebuggerConnectionHandler::StartHandler(const char* address, | 1086 void DebuggerConnectionHandler::StartHandler(const char* address, |
| 1072 int port_number) { | 1087 int port_number) { |
| 1073 if (handler_started_) { | 1088 if (handler_started_) { |
| 1074 return; | 1089 return; |
| 1075 } | 1090 } |
| 1076 ASSERT(listener_fd_ == -1); | 1091 ASSERT(listener_fd_ == -1); |
| 1077 listener_fd_ = ServerSocket::CreateBindListen(address, port_number, 1); | 1092 listener_fd_ = ServerSocket::CreateBindListen(address, port_number, 1); |
| 1078 | 1093 |
| 1079 handler_started_ = true; | 1094 handler_started_ = true; |
| 1080 DebuggerConnectionImpl::StartHandler(port_number); | 1095 DebuggerConnectionImpl::StartHandler(port_number); |
| 1096 Dart_SetIsolateEventHandler(IsolateEventHandler); |
| 1081 Dart_SetBreakpointHandler(BreakpointHandler); | 1097 Dart_SetBreakpointHandler(BreakpointHandler); |
| 1082 Dart_SetBreakpointResolvedHandler(BptResolvedHandler); | 1098 Dart_SetBreakpointResolvedHandler(BptResolvedHandler); |
| 1083 Dart_SetExceptionThrownHandler(ExceptionThrownHandler); | 1099 Dart_SetExceptionThrownHandler(ExceptionThrownHandler); |
| 1084 } | 1100 } |
| 1085 | 1101 |
| 1086 | 1102 |
| 1087 DebuggerConnectionHandler::~DebuggerConnectionHandler() { | 1103 DebuggerConnectionHandler::~DebuggerConnectionHandler() { |
| 1088 CloseDbgConnection(); | 1104 CloseDbgConnection(); |
| 1089 } | 1105 } |
| OLD | NEW |