Chromium Code Reviews| 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)) { |