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

Unified Diff: runtime/bin/dbg_connection.cc

Issue 10657048: Debugger support to display global variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
Index: runtime/bin/dbg_connection.cc
===================================================================
--- runtime/bin/dbg_connection.cc (revision 9118)
+++ runtime/bin/dbg_connection.cc (working copy)
@@ -564,16 +564,17 @@
Dart_Handle func_name;
Dart_Handle script_url;
intptr_t line_number = 0;
+ intptr_t library_id = 0;
res = Dart_ActivationFrameInfo(
- frame, &func_name, &script_url, &line_number);
-
+ frame, &func_name, &script_url, &line_number, &library_id);
ASSERT_NOT_ERROR(res);
ASSERT(Dart_IsString(func_name));
msg->Printf("%s{\"functionName\":", (i > 0) ? "," : "");
FormatEncodedString(msg, func_name);
+ msg->Printf(",\"libraryId\": %d,", library_id);
ASSERT(Dart_IsString(script_url));
- msg->Printf(",\"location\": { \"url\":");
+ msg->Printf("\"location\": { \"url\":");
FormatEncodedString(msg, script_url);
msg->Printf(",\"lineNumber\":%d},", line_number);
@@ -698,10 +699,10 @@
void DebuggerConnectionHandler::HandleGetLibPropsCmd(const char* json_msg) {
int msg_id = msgbuf_->MessageId();
- intptr_t cls_id = msgbuf_->GetIntParam("libraryId");
+ intptr_t lib_id = msgbuf_->GetIntParam("libraryId");
dart::TextBuffer msg(64);
msg.Printf("{\"id\":%d, \"result\":", msg_id);
- const char* err = FormatLibraryProps(&msg, cls_id);
+ const char* err = FormatLibraryProps(&msg, lib_id);
if (err != NULL) {
SendError(msg_id, err);
return;
@@ -711,6 +712,19 @@
}
+void DebuggerConnectionHandler::HandleGetGlobalsCmd(const char* json_msg) {
+ int msg_id = msgbuf_->MessageId();
+ intptr_t lib_id = msgbuf_->GetIntParam("libraryId");
+ dart::TextBuffer msg(64);
+ msg.Printf("{\"id\":%d, \"result\": { \"globals\":", msg_id);
+ Dart_Handle globals = Dart_GetGlobalVariables(lib_id);
+ ASSERT_NOT_ERROR(globals);
+ FormatFieldList(&msg, globals);
+ msg.Printf("}}");
+ SendMsg(&msg);
+}
+
+
void DebuggerConnectionHandler::HandleUnknownMsg(const char* json_msg) {
int msg_id = msgbuf_->MessageId();
ASSERT(msg_id >= 0);
@@ -725,6 +739,7 @@
{ "getClassProperties", HandleGetClassPropsCmd },
{ "getLibraryProperties", HandleGetLibPropsCmd },
{ "getObjectProperties", HandleGetObjPropsCmd },
+ { "getGlobalVariables", HandleGetGlobalsCmd },
{ "getScriptURLs", HandleGetScriptURLsCmd },
{ "getScriptSource", HandleGetSourceCmd },
{ "getStackTrace", HandleGetStackTraceCmd },

Powered by Google App Engine
This is Rietveld 408576698