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

Unified Diff: runtime/vm/service.cc

Issue 1312763010: Support column-based breakpoints in the VM and Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index de7c7fe7afed65b6de794f3fe14f56fa9d458862..fc0c1b89260d4938405cc05cd0035b8059bbf4d2 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -2039,8 +2039,10 @@ static bool GetCallSiteData(Isolate* isolate, JSONStream* js) {
static const MethodParameter* add_breakpoint_params[] = {
ISOLATE_PARAMETER,
- new IdParameter("scriptId", true),
+ new IdParameter("scriptId", false),
+ new IdParameter("scriptUrl", false),
new UIntParameter("line", true),
+ new UIntParameter("column", false),
NULL,
};
@@ -2048,16 +2050,41 @@ static const MethodParameter* add_breakpoint_params[] = {
static bool AddBreakpoint(Isolate* isolate, JSONStream* js) {
const char* line_param = js->LookupParam("line");
intptr_t line = UIntParameter::Parse(line_param);
- const char* script_id = js->LookupParam("scriptId");
- Object& obj = Object::Handle(LookupHeapObject(isolate, script_id, NULL));
- if (obj.raw() == Object::sentinel().raw() || !obj.IsScript()) {
- PrintInvalidParamError(js, "scriptId");
+ const char* col_param = js->LookupParam("column");
+ intptr_t col = -1;
+ if (col_param != NULL) {
+ col = UIntParameter::Parse(col_param);
+ if (col == 0) {
+ // Column number is 1-based.
+ PrintInvalidParamError(js, "column");
+ return true;
+ }
+ }
+ const char* script_id_param = js->LookupParam("scriptId");
+ const char* script_url_param = js->LookupParam("scriptUrl");
+ if (script_id_param == NULL && script_url_param == NULL) {
+ js->PrintError(kInvalidParams,
+ "%s expects the 'scriptId' or the 'scriptUrl' parameter",
+ js->method());
return true;
}
- const Script& script = Script::Cast(obj);
- const String& script_url = String::Handle(script.url());
- Breakpoint* bpt =
- isolate->debugger()->SetBreakpointAtLine(script_url, line);
+ String& script_url = String::Handle(isolate);
+ if (script_id_param != NULL) {
+ Object& obj =
+ Object::Handle(LookupHeapObject(isolate, script_id_param, NULL));
+ if (obj.raw() == Object::sentinel().raw() || !obj.IsScript()) {
+ PrintInvalidParamError(js, "scriptId");
+ return true;
+ }
+ const Script& script = Script::Cast(obj);
+ script_url = script.url();
+ }
+ if (script_url_param != NULL) {
+ script_url = String::New(script_url_param);
+ }
+ ASSERT(!script_url.IsNull());
+ Breakpoint* bpt = NULL;
+ bpt = isolate->debugger()->SetBreakpointAtLineCol(script_url, line, col);
if (bpt == NULL) {
js->PrintError(kCannotAddBreakpoint,
"%s: Cannot add breakpoint at line '%s'",

Powered by Google App Engine
This is Rietveld 408576698