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

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 a9eea6ae6174ca2a4e1032d023fd918a9511cfee..aae51c47852634c0ae49cd8479b386f7869bbc32 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1443,7 +1443,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;
@@ -1453,9 +1456,16 @@ static Breakpoint* LookupBreakpoint(Isolate* isolate, const char* id) {
intptr_t bpt_id = 0;
Breakpoint* bpt = NULL;
if (GetIntegerId(rest, &bpt_id)) {
- bpt = isolate->debugger()->GetBreakpointById(bpt_id);
+ if (bpt_id >= isolate->debugger()->limitBreakpointId()) {
+ *result = ObjectIdRing::kCollected;
Cutch 2015/09/11 19:22:19 We've been asked for a breakpoint id larger than a
+ } else {
+ bpt = isolate->debugger()->GetBreakpointById(bpt_id);
+ if (bpt) {
+ *result = ObjectIdRing::kValid;
+ return bpt;
+ }
+ }
}
- return bpt;
}
return NULL;
}
@@ -2166,7 +2176,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;
@@ -2821,10 +2834,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;
}
if (PrintMessage(js, isolate, id)) {
« 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