Chromium Code Reviews| Index: runtime/vm/service.cc |
| diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc |
| index afc31be2c2550e26e05d32107b94cd64f826fb00..7d38a2083987e742f54e782a2e650a5a0dee4459 100644 |
| --- a/runtime/vm/service.cc |
| +++ b/runtime/vm/service.cc |
| @@ -1057,19 +1057,61 @@ static bool HandleCpu(Isolate* isolate, JSONStream* js) { |
| } |
| +static bool HandleNativeCode(uintptr_t pc, JSONStream* js) { |
| + Object::null_object().PrintToJSONStream(js, false); |
| + return true; |
| +} |
| + |
| + |
| +static bool HandleCollectedCode(uintptr_t pc, JSONStream* js) { |
| + Object::null_object().PrintToJSONStream(js, false); |
| + return true; |
| +} |
| + |
| + |
| static bool HandleCode(Isolate* isolate, JSONStream* js) { |
| REQUIRE_COLLECTION_ID("code"); |
| uintptr_t pc; |
| + if (js->num_arguments() > 3) { |
| + PrintError(js, "Command too long"); |
| + return true; |
| + } |
| + if (js->num_arguments() == 3) { |
| + const char* command = js->GetArgument(1); |
| + if (!strcmp("collected", command)) { |
|
Ivan Posva
2014/02/28 21:46:35
strcmp does not return a bool.
|
| + if (!GetUnsignedIntegerId(js->GetArgument(1), &pc, 16)) { |
| + PrintError(js, "Must specify code address: code/collected/c0deadd0."); |
| + return true; |
| + } |
| + return HandleCollectedCode(pc, js); |
| + } else if (!strcmp("native", command)) { |
| + if (!GetUnsignedIntegerId(js->GetArgument(1), &pc, 16)) { |
| + PrintError(js, "Must specify code address: code/native/c0deadd0."); |
| + return true; |
| + } |
|
turnidge
2014/02/28 19:45:43
Since this is simpler now, you could drop the help
Cutch
2014/02/28 19:48:08
Done.
|
| + return HandleNativeCode(pc, js); |
| + } else { |
| + PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1)); |
| + return true; |
| + } |
| + } |
| + ASSERT(js->num_arguments() == 2); |
| if (!GetUnsignedIntegerId(js->GetArgument(1), &pc, 16)) { |
| PrintError(js, "Must specify code address: code/c0deadd0."); |
| return true; |
| } |
| - Code& code = Code::Handle(Code::LookupCode(pc)); |
| - if (code.IsNull()) { |
| - PrintError(js, "Could not find code at %" Px "", pc); |
| + Code& code = Code::Handle(); |
| + code ^= Code::LookupCode(pc); |
| + if (!code.IsNull()) { |
| + code.PrintToJSONStream(js, false); |
| + return true; |
| + } |
| + code ^= Code::LookupCodeInVmIsolate(pc); |
| + if (!code.IsNull()) { |
| + code.PrintToJSONStream(js, false); |
| return true; |
| } |
| - code.PrintToJSONStream(js, false); |
| + PrintError(js, "Could not find code at %" Px "", pc); |
| return true; |
| } |