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

Unified Diff: runtime/bin/dbg_message.cc

Issue 13533016: Add line table command to debugger (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/dbg_message.h ('k') | runtime/include/dart_debugger_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dbg_message.cc
===================================================================
--- runtime/bin/dbg_message.cc (revision 21008)
+++ runtime/bin/dbg_message.cc (working copy)
@@ -479,6 +479,7 @@
{ "getGlobalVariables", DbgMessage::HandleGetGlobalsCmd },
{ "getScriptURLs", DbgMessage::HandleGetScriptURLsCmd },
{ "getScriptSource", DbgMessage::HandleGetSourceCmd },
+ { "getLineNumberTable", DbgMessage::HandleGetLineNumbersCmd },
{ "getStackTrace", DbgMessage::HandleGetStackTraceCmd },
{ "setBreakpoint", DbgMessage::HandleSetBpCmd },
{ "setPauseOnException", DbgMessage::HandlePauseOnExcCmd },
@@ -788,6 +789,53 @@
}
+bool DbgMessage::HandleGetLineNumbersCmd(DbgMessage* in_msg) {
+ ASSERT(in_msg != NULL);
+ MessageParser msg_parser(in_msg->buffer(), in_msg->buffer_len());
+ int msg_id = msg_parser.MessageId();
+ dart::TextBuffer msg(64);
+ intptr_t lib_id = msg_parser.GetIntParam("libraryId");
+ char* url_chars = msg_parser.GetStringParam("url");
+ ASSERT(url_chars != NULL);
+ Dart_Handle url = DartUtils::NewString(url_chars);
+ ASSERT_NOT_ERROR(url);
+ free(url_chars);
+ url_chars = NULL;
+ Dart_Handle info = Dart_ScriptGetTokenInfo(lib_id, url);
+ if (Dart_IsError(info)) {
+ in_msg->SendErrorReply(msg_id, Dart_GetError(info));
+ return false;
+ }
+ ASSERT(Dart_IsList(info));
+ intptr_t info_len = 0;
+ Dart_Handle res = Dart_ListLength(info, &info_len);
+ ASSERT_NOT_ERROR(res);
+ msg.Printf("{ \"id\": %d, ", msg_id);
+ msg.Printf("\"result\": { \"lines\": [");
+ Dart_Handle elem;
+ bool num_elems = 0;
+ for (intptr_t i = 0; i < info_len; i++) {
+ elem = Dart_ListGetAt(info, i);
+ if (Dart_IsNull(elem)) {
+ msg.Printf((i == 0) ? "[" : "], [");
+ num_elems = 0;
+ } else {
+ ASSERT(Dart_IsInteger(elem));
+ int value = GetIntValue(elem);
+ if (num_elems == 0) {
+ msg.Printf("%d", value);
+ } else {
+ msg.Printf(",%d", value);
+ }
+ num_elems++;
+ }
+ }
+ msg.Printf("]]}}");
+ in_msg->SendReply(&msg);
+ return false;
+}
+
+
bool DbgMessage::HandleGetStackTraceCmd(DbgMessage* in_msg) {
ASSERT(in_msg != NULL);
MessageParser msg_parser(in_msg->buffer(), in_msg->buffer_len());
« no previous file with comments | « runtime/bin/dbg_message.h ('k') | runtime/include/dart_debugger_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698