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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 result.PrintJSON(js, true); 1512 result.PrintJSON(js, true);
1513 return true; 1513 return true;
1514 } 1514 }
1515 PrintError(js, "%s: Invalid 'targetId' parameter value: " 1515 PrintError(js, "%s: Invalid 'targetId' parameter value: "
1516 "id '%s' does not correspond to a " 1516 "id '%s' does not correspond to a "
1517 "library, class, or instance", js->method(), target_id); 1517 "library, class, or instance", js->method(), target_id);
1518 return true; 1518 return true;
1519 } 1519 }
1520 1520
1521 1521
1522 static const MethodParameter* eval_frame_params[] = {
1523 ISOLATE_PARAMETER,
1524 new UIntParameter("frame", true),
1525 new MethodParameter("expression", true),
1526 NULL,
1527 };
1528
1529
1530 static bool EvalFrame(Isolate* isolate, JSONStream* js) {
1531 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
1532 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frame"));
1533 if (framePos > stack->Length()) {
1534 PrintInvalidParamError(js, "frame");
1535 return true;
1536 }
1537 ActivationFrame* frame = stack->FrameAt(framePos);
1538
1539 const char* expr = js->LookupParam("expression");
1540 const String& expr_str = String::Handle(isolate, String::New(expr));
1541
1542 const Object& result = Object::Handle(frame->Evaluate(expr_str));
1543 result.PrintJSON(js, true);
1544 return true;
1545 }
1546
1547
1522 static const MethodParameter* get_call_site_data_params[] = { 1548 static const MethodParameter* get_call_site_data_params[] = {
1523 ISOLATE_PARAMETER, 1549 ISOLATE_PARAMETER,
1524 new IdParameter("targetId", true), 1550 new IdParameter("targetId", true),
1525 NULL, 1551 NULL,
1526 }; 1552 };
1527 1553
1528 1554
1529 static bool GetCallSiteData(Isolate* isolate, JSONStream* js) { 1555 static bool GetCallSiteData(Isolate* isolate, JSONStream* js) {
1530 const char* target_id = js->LookupParam("targetId"); 1556 const char* target_id = js->LookupParam("targetId");
1531 Object& obj = Object::Handle(LookupHeapObject(isolate, target_id, NULL)); 1557 Object& obj = Object::Handle(LookupHeapObject(isolate, target_id, NULL));
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2499 { "_triggerEchoEvent", _TriggerEchoEvent, 2525 { "_triggerEchoEvent", _TriggerEchoEvent,
2500 NULL }, 2526 NULL },
2501 { "addBreakpoint", AddBreakpoint, 2527 { "addBreakpoint", AddBreakpoint,
2502 add_breakpoint_params }, 2528 add_breakpoint_params },
2503 { "addBreakpointAtEntry", AddBreakpointAtEntry, 2529 { "addBreakpointAtEntry", AddBreakpointAtEntry,
2504 add_breakpoint_at_entry_params }, 2530 add_breakpoint_at_entry_params },
2505 { "clearCpuProfile", ClearCpuProfile, 2531 { "clearCpuProfile", ClearCpuProfile,
2506 clear_cpu_profile_params }, 2532 clear_cpu_profile_params },
2507 { "eval", Eval, 2533 { "eval", Eval,
2508 eval_params }, 2534 eval_params },
2535 { "evalFrame", EvalFrame,
2536 eval_frame_params },
2509 { "getAllocationProfile", GetAllocationProfile, 2537 { "getAllocationProfile", GetAllocationProfile,
2510 get_allocation_profile_params }, 2538 get_allocation_profile_params },
2511 { "getCallSiteData", GetCallSiteData, 2539 { "getCallSiteData", GetCallSiteData,
2512 get_call_site_data_params }, 2540 get_call_site_data_params },
2513 { "getClassList", GetClassList, 2541 { "getClassList", GetClassList,
2514 get_class_list_params }, 2542 get_class_list_params },
2515 { "getCoverage", GetCoverage, 2543 { "getCoverage", GetCoverage,
2516 get_coverage_params }, 2544 get_coverage_params },
2517 { "getCpuProfile", GetCpuProfile, 2545 { "getCpuProfile", GetCpuProfile,
2518 get_cpu_profile_params }, 2546 get_cpu_profile_params },
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 ServiceMethodDescriptor& method = service_methods_[i]; 2598 ServiceMethodDescriptor& method = service_methods_[i];
2571 if (strcmp(method_name, method.name) == 0) { 2599 if (strcmp(method_name, method.name) == 0) {
2572 return &method; 2600 return &method;
2573 } 2601 }
2574 } 2602 }
2575 return NULL; 2603 return NULL;
2576 } 2604 }
2577 2605
2578 2606
2579 } // namespace dart 2607 } // namespace dart
OLDNEW
« 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