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

Unified Diff: runtime/vm/service.cc

Issue 993613002: Implement 'print', 'up', 'down', and 'frame' commands in the Observatory debugger. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 0a638c1f972a6d2dd43d2937d5f8fb5a65e7198b..d38c74733f54018da83dd7ee360c1f47f535bc25 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1519,6 +1519,32 @@ static bool Eval(Isolate* isolate, JSONStream* js) {
}
+static const MethodParameter* eval_frame_params[] = {
+ ISOLATE_PARAMETER,
+ new UIntParameter("frame", true),
+ new MethodParameter("expression", true),
+ NULL,
+};
+
+
+static bool EvalFrame(Isolate* isolate, JSONStream* js) {
+ DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
+ intptr_t framePos = UIntParameter::Parse(js->LookupParam("frame"));
+ if (framePos > stack->Length()) {
+ PrintInvalidParamError(js, "frame");
+ return true;
+ }
+ ActivationFrame* frame = stack->FrameAt(framePos);
+
+ const char* expr = js->LookupParam("expression");
+ const String& expr_str = String::Handle(isolate, String::New(expr));
+
+ const Object& result = Object::Handle(frame->Evaluate(expr_str));
+ result.PrintJSON(js, true);
+ return true;
+}
+
+
static const MethodParameter* get_call_site_data_params[] = {
ISOLATE_PARAMETER,
new IdParameter("targetId", true),
@@ -2506,6 +2532,8 @@ static ServiceMethodDescriptor service_methods_[] = {
clear_cpu_profile_params },
{ "eval", Eval,
eval_params },
+ { "evalFrame", EvalFrame,
+ eval_frame_params },
{ "getAllocationProfile", GetAllocationProfile,
get_allocation_profile_params },
{ "getCallSiteData", GetCallSiteData,
« runtime/observatory/lib/src/elements/debugger.dart ('K') | « runtime/vm/debugger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698