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

Unified Diff: runtime/vm/service.cc

Issue 1341473002: Fix a variety of service protocol bugs. (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
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/service/service.md » ('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 7f8e353fc52a570fad3f1590e997ac3eef36cd5f..4cb379eeb177e48843c5bef39274597f6054cc35 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1468,7 +1468,10 @@ static void PrintSentinel(JSONStream* js, SentinelType sentinel_type) {
}
-static Breakpoint* LookupBreakpoint(Isolate* isolate, const char* id) {
+static Breakpoint* LookupBreakpoint(Isolate* isolate,
+ const char* id,
+ ObjectIdRing::LookupResult* result) {
+ *result = ObjectIdRing::kInvalid;
size_t end_pos = strcspn(id, "/");
if (end_pos == strlen(id)) {
return NULL;
@@ -1479,8 +1482,15 @@ static Breakpoint* LookupBreakpoint(Isolate* isolate, const char* id) {
Breakpoint* bpt = NULL;
if (GetIntegerId(rest, &bpt_id)) {
bpt = isolate->debugger()->GetBreakpointById(bpt_id);
+ if (bpt) {
+ *result = ObjectIdRing::kValid;
+ return bpt;
+ }
+ if (bpt_id < isolate->debugger()->limitBreakpointId()) {
+ *result = ObjectIdRing::kCollected;
+ return NULL;
+ }
}
- return bpt;
}
return NULL;
}
@@ -2158,7 +2168,10 @@ static bool RemoveBreakpoint(Isolate* isolate, JSONStream* js) {
return true;
}
const char* bpt_id = js->LookupParam("breakpointId");
- Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id);
+ ObjectIdRing::LookupResult lookup_result;
+ Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id, &lookup_result);
+ // TODO(turnidge): Should we return a different error for bpts whic
+ // have been already removed?
if (bpt == NULL) {
PrintInvalidParamError(js, "breakpointId");
return true;
@@ -2813,10 +2826,13 @@ static bool GetObject(Isolate* isolate, JSONStream* js) {
}
// Handle non-heap objects.
- Breakpoint* bpt = LookupBreakpoint(isolate, id);
+ Breakpoint* bpt = LookupBreakpoint(isolate, id, &lookup_result);
if (bpt != NULL) {
bpt->PrintJSON(js);
return true;
+ } else if (lookup_result == ObjectIdRing::kCollected) {
+ PrintSentinel(js, kCollectedSentinel);
+ return true;
}
PrintInvalidParamError(js, "objectId");
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698