Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: runtime/bin/dbg_connection.cc

Issue 14381005: Implement list isolates command (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/dbg_message.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 struct JSONDebuggerCommand { 174 struct JSONDebuggerCommand {
175 const char* cmd_string; 175 const char* cmd_string;
176 CommandHandler handler_function; 176 CommandHandler handler_function;
177 }; 177 };
178 178
179 179
180 void DebuggerConnectionHandler::HandleMessages() { 180 void DebuggerConnectionHandler::HandleMessages() {
181 static JSONDebuggerCommand generic_debugger_commands[] = { 181 static JSONDebuggerCommand generic_debugger_commands[] = {
182 { "interrupt", HandleInterruptCmd }, 182 { "interrupt", HandleInterruptCmd },
183 { "isolates", HandleIsolatesListCmd }, 183 { "getIsolateIds", HandleIsolatesListCmd },
184 { NULL, NULL } 184 { NULL, NULL }
185 }; 185 };
186 186
187 for (;;) { 187 for (;;) {
188 // Read a message. 188 // Read a message.
189 while (!msgbuf_->IsValidMessage() && msgbuf_->Alive()) { 189 while (!msgbuf_->IsValidMessage() && msgbuf_->Alive()) {
190 msgbuf_->ReadData(); 190 msgbuf_->ReadData();
191 } 191 }
192 if (!msgbuf_->Alive()) { 192 if (!msgbuf_->Alive()) {
193 return; 193 return;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 dart::TextBuffer msg(64); 397 dart::TextBuffer msg(64);
398 msg.Printf("{ \"id\": %d }", msg_id); 398 msg.Printf("{ \"id\": %d }", msg_id);
399 in_msg->SendReply(&msg); 399 in_msg->SendReply(&msg);
400 } 400 }
401 401
402 402
403 void DebuggerConnectionHandler::HandleIsolatesListCmd(DbgMessage* in_msg) { 403 void DebuggerConnectionHandler::HandleIsolatesListCmd(DbgMessage* in_msg) {
404 MessageParser msg_parser(in_msg->buffer(), in_msg->buffer_len()); 404 MessageParser msg_parser(in_msg->buffer(), in_msg->buffer_len());
405 int msg_id = msg_parser.MessageId(); 405 int msg_id = msg_parser.MessageId();
406 ASSERT(msg_id >= 0); 406 ASSERT(msg_id >= 0);
407 in_msg->SendErrorReply(msg_id, "isolate list command unimplemented"); 407 dart::TextBuffer msg(64);
408 msg.Printf("{ \"id\": %d, \"result\": { \"isolateIds\": [", msg_id);
409 DbgMsgQueueList::ListIsolateIds(&msg);
410 msg.Printf("]}}");
411 in_msg->SendReply(&msg);
408 } 412 }
409 413
410 414
411 void DebuggerConnectionHandler::AddNewDebuggerConnection(int debug_fd) { 415 void DebuggerConnectionHandler::AddNewDebuggerConnection(int debug_fd) {
412 // TODO(asiva): Support multiple debugger connections, for now we just 416 // TODO(asiva): Support multiple debugger connections, for now we just
413 // create one handler, store it in a static variable and use it. 417 // create one handler, store it in a static variable and use it.
414 ASSERT(singleton_handler == NULL); 418 ASSERT(singleton_handler == NULL);
415 singleton_handler = new DebuggerConnectionHandler(debug_fd); 419 singleton_handler = new DebuggerConnectionHandler(debug_fd);
416 } 420 }
417 421
(...skipping 13 matching lines...) Expand all
431 ASSERT(singleton_handler != NULL); 435 ASSERT(singleton_handler != NULL);
432 return singleton_handler; 436 return singleton_handler;
433 } 437 }
434 438
435 439
436 bool DebuggerConnectionHandler::IsConnected() { 440 bool DebuggerConnectionHandler::IsConnected() {
437 // TODO(asiva): Support multiple debugger connections. 441 // TODO(asiva): Support multiple debugger connections.
438 // Return true if a connection has been established. 442 // Return true if a connection has been established.
439 return singleton_handler != NULL; 443 return singleton_handler != NULL;
440 } 444 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dbg_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698