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

Unified Diff: runtime/bin/dbg_connection.cc

Issue 10797033: Debugger API to enable/disable debugging of libraries (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 9763)
+++ runtime/bin/dbg_connection.cc (working copy)
@@ -543,12 +543,19 @@
buf->Printf("{\"url\":");
FormatEncodedString(buf, url);
+ // Whether debugging is enabled.
+ bool is_debuggable= false;
regis 2012/07/19 20:40:57 missing space
hausner 2012/07/19 22:50:35 Done.
+ Dart_Handle res = Dart_GetLibraryDebuggable(lib_id, &is_debuggable);
+ RETURN_IF_ERROR(res);
+ buf->Printf(",\"debuggingEnabled\":%s",
+ is_debuggable ? "\"true\"" : "\"false\"");
+
// Imports and prefixes.
Dart_Handle import_list = Dart_GetLibraryImports(lib_id);
RETURN_IF_ERROR(import_list);
ASSERT(Dart_IsList(import_list));
intptr_t list_length = 0;
- Dart_Handle res = Dart_ListLength(import_list, &list_length);
+ res = Dart_ListLength(import_list, &list_length);
RETURN_IF_ERROR(res);
buf->Printf(",\"imports\":[");
for (int i = 0; i + 1 < list_length; i += 2) {
@@ -829,6 +836,38 @@
}
+void DebuggerConnectionHandler::HandleSetLibPropsCmd(const char* json_msg) {
+ int msg_id = msgbuf_->MessageId();
+ intptr_t lib_id = msgbuf_->GetIntParam("libraryId");
+ const char* enable_request = msgbuf_->GetStringParam("debuggingEnabled");
+ bool enable;
+ if (strcmp(enable_request, "true") == 0) {
+ enable = true;
+ } else if (strcmp(enable_request, "true")) {
regis 2012/07/19 20:40:57 You probably mean } else if (strcmp(enable_reques
hausner 2012/07/19 22:50:35 Yes. Ironically my faulty code also works if the i
+ enable = false;
+ } else {
+ SendError(msg_id, "illegal argument for 'debuggingEnabled'");
+ return;
+ }
+ Dart_Handle res = Dart_SetLibraryDebuggable(lib_id, enable);
+ if (Dart_IsError(res)) {
+ SendError(msg_id, Dart_GetError(res));
+ return;
+ }
+ bool enabled = false;
+ res = Dart_GetLibraryDebuggable(lib_id, &enabled);
+ if (Dart_IsError(res)) {
+ SendError(msg_id, Dart_GetError(res));
+ return;
+ }
+ dart::TextBuffer msg(64);
+ msg.Printf("{\"id\":%d, \"result\": {\"debuggingEnabled\": \"%s\"}}",
+ msg_id,
+ enabled ? "true" : "false");
+ SendMsg(&msg);
+}
+
+
void DebuggerConnectionHandler::HandleGetGlobalsCmd(const char* json_msg) {
int msg_id = msgbuf_->MessageId();
intptr_t lib_id = msgbuf_->GetIntParam("libraryId");
@@ -855,6 +894,7 @@
{ "getLibraries", HandleGetLibrariesCmd },
{ "getClassProperties", HandleGetClassPropsCmd },
{ "getLibraryProperties", HandleGetLibPropsCmd },
+ { "setLibraryProperties", HandleSetLibPropsCmd },
{ "getObjectProperties", HandleGetObjPropsCmd },
{ "getListElements", HandleGetListCmd },
{ "getGlobalVariables", HandleGetGlobalsCmd },

Powered by Google App Engine
This is Rietveld 408576698