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

Unified Diff: runtime/vm/service.cc

Issue 1146173003: Per-closure breakpoints; restructure breakpoint implementation to keep a list of conditions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/vm/object_test.cc ('k') | runtime/vm/service_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 19cd84a357b2edf1a3d9e7e4a6f0aac905e71d06..ef9dabf9e5e8574ced57e2cd05b302da3aa01780 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1196,7 +1196,7 @@ static void PrintSentinel(JSONStream* js, SentinelType sentinel_type) {
}
-static SourceBreakpoint* LookupBreakpoint(Isolate* isolate, const char* id) {
+static Breakpoint* LookupBreakpoint(Isolate* isolate, const char* id) {
size_t end_pos = strcspn(id, "/");
if (end_pos == strlen(id)) {
return NULL;
@@ -1204,7 +1204,7 @@ static SourceBreakpoint* LookupBreakpoint(Isolate* isolate, const char* id) {
const char* rest = id + end_pos + 1; // +1 for '/'.
if (strncmp("breakpoints", id, end_pos) == 0) {
intptr_t bpt_id = 0;
- SourceBreakpoint* bpt = NULL;
+ Breakpoint* bpt = NULL;
if (GetIntegerId(rest, &bpt_id)) {
bpt = isolate->debugger()->GetBreakpointById(bpt_id);
}
@@ -1808,7 +1808,7 @@ static bool AddBreakpoint(Isolate* isolate, JSONStream* js) {
}
const Script& script = Script::Cast(obj);
const String& script_url = String::Handle(script.url());
- SourceBreakpoint* bpt =
+ Breakpoint* bpt =
isolate->debugger()->SetBreakpointAtLine(script_url, line);
if (bpt == NULL) {
js->PrintError(kNoBreakAtLine, NULL);
@@ -1834,8 +1834,34 @@ static bool AddBreakpointAtEntry(Isolate* isolate, JSONStream* js) {
return true;
}
const Function& function = Function::Cast(obj);
- SourceBreakpoint* bpt =
- isolate->debugger()->SetBreakpointAtEntry(function);
+ Breakpoint* bpt =
+ isolate->debugger()->SetBreakpointAtEntry(function, false);
+ if (bpt == NULL) {
+ js->PrintError(kNoBreakAtFunction, NULL);
+ return true;
+ }
+ bpt->PrintJSON(js);
+ return true;
+}
+
+
+static const MethodParameter* add_breakpoint_at_activation_params[] = {
+ ISOLATE_PARAMETER,
+ new IdParameter("objectId", true),
+ NULL,
+};
+
+
+static bool AddBreakpointAtActivation(Isolate* isolate, JSONStream* js) {
+ const char* object_id = js->LookupParam("objectId");
+ Object& obj = Object::Handle(LookupHeapObject(isolate, object_id, NULL));
+ if (obj.raw() == Object::sentinel().raw() || !obj.IsInstance()) {
+ PrintInvalidParamError(js, "objectId");
+ return true;
+ }
+ const Instance& closure = Instance::Cast(obj);
+ Breakpoint* bpt =
+ isolate->debugger()->SetBreakpointAtActivation(closure);
if (bpt == NULL) {
js->PrintError(kNoBreakAtFunction, NULL);
return true;
@@ -1857,7 +1883,7 @@ static bool RemoveBreakpoint(Isolate* isolate, JSONStream* js) {
return true;
}
const char* bpt_id = js->LookupParam("breakpointId");
- SourceBreakpoint* bpt = LookupBreakpoint(isolate, bpt_id);
+ Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id);
if (bpt == NULL) {
fprintf(stderr, "ERROR1");
PrintInvalidParamError(js, "breakpointId");
@@ -2384,7 +2410,7 @@ static bool GetObject(Isolate* isolate, JSONStream* js) {
}
// Handle non-heap objects.
- SourceBreakpoint* bpt = LookupBreakpoint(isolate, id);
+ Breakpoint* bpt = LookupBreakpoint(isolate, id);
if (bpt != NULL) {
bpt->PrintJSON(js);
return true;
@@ -2574,6 +2600,8 @@ static ServiceMethodDescriptor service_methods_[] = {
add_breakpoint_params },
{ "addBreakpointAtEntry", AddBreakpointAtEntry,
add_breakpoint_at_entry_params },
+ { "_addBreakpointAtActivation", AddBreakpointAtActivation,
+ add_breakpoint_at_activation_params },
{ "clearCpuProfile", ClearCpuProfile,
clear_cpu_profile_params },
{ "evaluate", Evaluate,
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/service_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698