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/dbg_message.h" | 6 #include "bin/dbg_message.h" |
7 #include "bin/dartutils.h" | 7 #include "bin/dartutils.h" |
8 #include "bin/log.h" | 8 #include "bin/log.h" |
9 #include "bin/socket.h" | 9 #include "bin/socket.h" |
10 #include "bin/thread.h" | 10 #include "bin/thread.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 if (!is_handled) { | 246 if (!is_handled) { |
247 // Check if this is an isolate specific command. | 247 // Check if this is an isolate specific command. |
248 int32_t cmd_idx = DbgMsgQueueList::LookupIsolateCommand(r.ValueChars(), | 248 int32_t cmd_idx = DbgMsgQueueList::LookupIsolateCommand(r.ValueChars(), |
249 r.ValueLen()); | 249 r.ValueLen()); |
250 if (cmd_idx != DbgMsgQueueList::kInvalidCommand) { | 250 if (cmd_idx != DbgMsgQueueList::kInvalidCommand) { |
251 const char* start = msgbuf_->buf(); | 251 const char* start = msgbuf_->buf(); |
252 const char* end = r.EndOfObject(); | 252 const char* end = r.EndOfObject(); |
253 // Get debug message queue corresponding to isolate. | 253 // Get debug message queue corresponding to isolate. |
254 MessageParser msg_parser(start, (end - start)); | 254 MessageParser msg_parser(start, (end - start)); |
255 Dart_IsolateId isolate_id = | 255 Dart_IsolateId isolate_id = msg_parser.GetInt64Param("isolateId"); |
256 static_cast<Dart_IsolateId>(msg_parser.GetIntParam("isolateId")); | |
257 if (!DbgMsgQueueList::AddIsolateMessage(isolate_id, | 256 if (!DbgMsgQueueList::AddIsolateMessage(isolate_id, |
258 cmd_idx, | 257 cmd_idx, |
259 msgbuf_->buf(), | 258 msgbuf_->buf(), |
260 r.EndOfObject(), | 259 r.EndOfObject(), |
261 debug_fd_)) { | 260 debug_fd_)) { |
262 SendError(debug_fd_, MessageId(), "Invalid isolate specified"); | 261 SendError(debug_fd_, MessageId(), "Invalid isolate specified"); |
263 } | 262 } |
264 msgbuf_->PopMessage(); | 263 msgbuf_->PopMessage(); |
265 continue; | 264 continue; |
266 } | 265 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (handler != NULL) { | 422 if (handler != NULL) { |
424 handler->HandleMessages(); | 423 handler->HandleMessages(); |
425 delete handler; | 424 delete handler; |
426 } | 425 } |
427 } | 426 } |
428 | 427 |
429 | 428 |
430 void DebuggerConnectionHandler::HandleInterruptCmd(DbgMessage* in_msg) { | 429 void DebuggerConnectionHandler::HandleInterruptCmd(DbgMessage* in_msg) { |
431 MessageParser msg_parser(in_msg->buffer(), in_msg->buffer_len()); | 430 MessageParser msg_parser(in_msg->buffer(), in_msg->buffer_len()); |
432 int msg_id = msg_parser.MessageId(); | 431 int msg_id = msg_parser.MessageId(); |
433 Dart_IsolateId isolate_id = | 432 Dart_IsolateId isolate_id = msg_parser.GetInt64Param("isolateId"); |
434 static_cast<Dart_IsolateId>(msg_parser.GetIntParam("isolateId")); | |
435 if (isolate_id == ILLEGAL_ISOLATE_ID || Dart_GetIsolate(isolate_id) == NULL) { | 433 if (isolate_id == ILLEGAL_ISOLATE_ID || Dart_GetIsolate(isolate_id) == NULL) { |
436 in_msg->SendErrorReply(msg_id, "Invalid isolate specified"); | 434 in_msg->SendErrorReply(msg_id, "Invalid isolate specified"); |
437 return; | 435 return; |
438 } | 436 } |
439 if (!DbgMsgQueueList::InterruptIsolate(isolate_id)) { | 437 if (!DbgMsgQueueList::InterruptIsolate(isolate_id)) { |
440 in_msg->SendErrorReply(msg_id, "Invalid isolate specified"); | 438 in_msg->SendErrorReply(msg_id, "Invalid isolate specified"); |
441 return; | 439 return; |
442 } | 440 } |
443 dart::TextBuffer msg(64); | 441 dart::TextBuffer msg(64); |
444 msg.Printf("{ \"id\": %d }", msg_id); | 442 msg.Printf("{ \"id\": %d }", msg_id); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 482 |
485 | 483 |
486 bool DebuggerConnectionHandler::IsConnected() { | 484 bool DebuggerConnectionHandler::IsConnected() { |
487 // TODO(asiva): Support multiple debugger connections. | 485 // TODO(asiva): Support multiple debugger connections. |
488 // Return true if a connection has been established. | 486 // Return true if a connection has been established. |
489 return singleton_handler != NULL; | 487 return singleton_handler != NULL; |
490 } | 488 } |
491 | 489 |
492 } // namespace bin | 490 } // namespace bin |
493 } // namespace dart | 491 } // namespace dart |
OLD | NEW |