| 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/fdutils.h" | 7 #include "bin/fdutils.h" |
| 8 #include "bin/socket.h" | 8 #include "bin/socket.h" |
| 9 #include "bin/thread.h" | 9 #include "bin/thread.h" |
| 10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ASSERT(IsValidJSON(msg.buf())); | 218 ASSERT(IsValidJSON(msg.buf())); |
| 219 } | 219 } |
| 220 | 220 |
| 221 | 221 |
| 222 void DebuggerConnectionHandler::BreakpointHandler(Dart_Breakpoint bpt, | 222 void DebuggerConnectionHandler::BreakpointHandler(Dart_Breakpoint bpt, |
| 223 Dart_StackTrace trace) { | 223 Dart_StackTrace trace) { |
| 224 // TODO(hausner): rather than busy-waiting, block on the pipe to the | 224 // TODO(hausner): rather than busy-waiting, block on the pipe to the |
| 225 // debugger thread and wait until a debugger connection has been | 225 // debugger thread and wait until a debugger connection has been |
| 226 // established. | 226 // established. |
| 227 while (!IsConnected()) { | 227 while (!IsConnected()) { |
| 228 printf("Waiting for debugger connection\n"); | 228 // Busy wait. |
| 229 sleep(1); | |
| 230 } | 229 } |
| 231 SendBreakpointEvent(bpt, trace); | 230 SendBreakpointEvent(bpt, trace); |
| 232 HandleMessages(); | 231 HandleMessages(); |
| 233 if (!msgbuf_->Alive()) { | 232 if (!msgbuf_->Alive()) { |
| 234 CloseDbgConnection(); | 233 CloseDbgConnection(); |
| 235 } | 234 } |
| 236 } | 235 } |
| 237 | 236 |
| 238 | 237 |
| 239 void DebuggerConnectionHandler::AcceptDbgConnection(int debugger_fd) { | 238 void DebuggerConnectionHandler::AcceptDbgConnection(int debugger_fd) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 264 | 263 |
| 265 handler_started_ = true; | 264 handler_started_ = true; |
| 266 DebuggerConnectionImpl::StartHandler(port_number); | 265 DebuggerConnectionImpl::StartHandler(port_number); |
| 267 Dart_SetBreakpointHandler(BreakpointHandler); | 266 Dart_SetBreakpointHandler(BreakpointHandler); |
| 268 } | 267 } |
| 269 | 268 |
| 270 | 269 |
| 271 DebuggerConnectionHandler::~DebuggerConnectionHandler() { | 270 DebuggerConnectionHandler::~DebuggerConnectionHandler() { |
| 272 CloseDbgConnection(); | 271 CloseDbgConnection(); |
| 273 } | 272 } |
| OLD | NEW |