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

Side by Side Diff: runtime/vm/debugger_api_impl.cc

Issue 23067006: Evaluate expression in context of an object (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « runtime/vm/compiler_test.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 6
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h"
8 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
9 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
10 #include "vm/debugger.h" 11 #include "vm/debugger.h"
11 #include "vm/isolate.h" 12 #include "vm/isolate.h"
12 #include "vm/object_store.h" 13 #include "vm/object_store.h"
13 #include "vm/symbols.h" 14 #include "vm/symbols.h"
14 15
15 namespace dart { 16 namespace dart {
16 17
17 #define UNWRAP_AND_CHECK_PARAM(type, var, param) \ 18 #define UNWRAP_AND_CHECK_PARAM(type, var, param) \
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return Api::NewHandle(isolate, frame->GetLocalVariables()); 283 return Api::NewHandle(isolate, frame->GetLocalVariables());
283 } 284 }
284 285
285 286
286 DART_EXPORT Dart_Handle Dart_SetBreakpoint( 287 DART_EXPORT Dart_Handle Dart_SetBreakpoint(
287 Dart_Handle script_url_in, 288 Dart_Handle script_url_in,
288 intptr_t line_number) { 289 intptr_t line_number) {
289 Isolate* isolate = Isolate::Current(); 290 Isolate* isolate = Isolate::Current();
290 DARTSCOPE(isolate); 291 DARTSCOPE(isolate);
291 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); 292 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
293
294 Dart_Handle state = Api::CheckIsolateState(isolate);
295 if (::Dart_IsError(state)) {
296 return state;
297 }
298
292 Debugger* debugger = isolate->debugger(); 299 Debugger* debugger = isolate->debugger();
293 ASSERT(debugger != NULL); 300 ASSERT(debugger != NULL);
294 SourceBreakpoint* bpt = 301 SourceBreakpoint* bpt =
295 debugger->SetBreakpointAtLine(script_url, line_number); 302 debugger->SetBreakpointAtLine(script_url, line_number);
296 if (bpt == NULL) { 303 if (bpt == NULL) {
297 return Api::NewError("%s: could not set breakpoint at line %"Pd" in '%s'", 304 return Api::NewError("%s: could not set breakpoint at line %"Pd" in '%s'",
298 CURRENT_FUNC, line_number, script_url.ToCString()); 305 CURRENT_FUNC, line_number, script_url.ToCString());
299 } 306 }
300 return Dart_NewInteger(bpt->id()); 307 return Dart_NewInteger(bpt->id());
301 } 308 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 DARTSCOPE(isolate); 491 DARTSCOPE(isolate);
485 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 492 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
486 if (lib.IsNull()) { 493 if (lib.IsNull()) {
487 return Api::NewError("%s: %"Pd" is not a valid library id", 494 return Api::NewError("%s: %"Pd" is not a valid library id",
488 CURRENT_FUNC, library_id); 495 CURRENT_FUNC, library_id);
489 } 496 }
490 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib)); 497 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib));
491 } 498 }
492 499
493 500
501 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target,
502 Dart_Handle expr_in) {
503 Isolate* isolate = Isolate::Current();
504 DARTSCOPE(isolate);
505 UNWRAP_AND_CHECK_PARAM(Instance, obj, target);
506 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in);
507 return Api::NewHandle(isolate, obj.Evaluate(expr));
508 }
509
510
494 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { 511 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) {
495 Isolate* isolate = Isolate::Current(); 512 Isolate* isolate = Isolate::Current();
496 DARTSCOPE(isolate); 513 DARTSCOPE(isolate);
497 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); 514 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in);
498 return Api::NewHandle(isolate, obj.clazz()); 515 return Api::NewHandle(isolate, obj.clazz());
499 } 516 }
500 517
501 518
502 DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in, 519 DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in,
503 intptr_t* class_id) { 520 intptr_t* class_id) {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 850
834 851
835 DART_EXPORT char* Dart_GetVmStatus(const char* request) { 852 DART_EXPORT char* Dart_GetVmStatus(const char* request) {
836 if (strncmp(request, "/isolate/", 9) == 0) { 853 if (strncmp(request, "/isolate/", 9) == 0) {
837 return Isolate::GetStatus(request); 854 return Isolate::GetStatus(request);
838 } 855 }
839 return NULL; 856 return NULL;
840 } 857 }
841 858
842 } // namespace dart 859 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler_test.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698