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

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

Issue 23072026: fix cpp11 compile errors (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/debugger.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/compiler.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return -1; 58 return -1;
59 } 59 }
60 return isolate->debugger()->CacheObject(obj); 60 return isolate->debugger()->CacheObject(obj);
61 } 61 }
62 62
63 63
64 DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { 64 DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) {
65 Isolate* isolate = Isolate::Current(); 65 Isolate* isolate = Isolate::Current();
66 DARTSCOPE(isolate); 66 DARTSCOPE(isolate);
67 if (!isolate->debugger()->IsValidObjectId(obj_id)) { 67 if (!isolate->debugger()->IsValidObjectId(obj_id)) {
68 return Api::NewError("%s: object id %"Pd" is invalid", 68 return Api::NewError("%s: object id %" Pd " is invalid",
69 CURRENT_FUNC, obj_id); 69 CURRENT_FUNC, obj_id);
70 } 70 }
71 return Api::NewHandle(isolate, isolate->debugger()->GetCachedObject(obj_id)); 71 return Api::NewHandle(isolate, isolate->debugger()->GetCachedObject(obj_id));
72 } 72 }
73 73
74 74
75 DART_EXPORT Dart_Handle Dart_StackTraceLength( 75 DART_EXPORT Dart_Handle Dart_StackTraceLength(
76 Dart_StackTrace trace, 76 Dart_StackTrace trace,
77 intptr_t* length) { 77 intptr_t* length) {
78 Isolate* isolate = Isolate::Current(); 78 Isolate* isolate = Isolate::Current();
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 Dart_Handle state = Api::CheckIsolateState(isolate); 294 Dart_Handle state = Api::CheckIsolateState(isolate);
295 if (::Dart_IsError(state)) { 295 if (::Dart_IsError(state)) {
296 return state; 296 return state;
297 } 297 }
298 298
299 Debugger* debugger = isolate->debugger(); 299 Debugger* debugger = isolate->debugger();
300 ASSERT(debugger != NULL); 300 ASSERT(debugger != NULL);
301 SourceBreakpoint* bpt = 301 SourceBreakpoint* bpt =
302 debugger->SetBreakpointAtLine(script_url, line_number); 302 debugger->SetBreakpointAtLine(script_url, line_number);
303 if (bpt == NULL) { 303 if (bpt == NULL) {
304 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'",
305 CURRENT_FUNC, line_number, script_url.ToCString()); 305 CURRENT_FUNC, line_number, script_url.ToCString());
306 } 306 }
307 return Dart_NewInteger(bpt->id()); 307 return Dart_NewInteger(bpt->id());
308 } 308 }
309 309
310 310
311 DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) { 311 DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) {
312 Isolate* isolate = Isolate::Current(); 312 Isolate* isolate = Isolate::Current();
313 DARTSCOPE(isolate); 313 DARTSCOPE(isolate);
314 Debugger* debugger = isolate->debugger(); 314 Debugger* debugger = isolate->debugger();
315 ASSERT(debugger != NULL); 315 ASSERT(debugger != NULL);
316 316
317 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id); 317 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id);
318 if (bpt == NULL) { 318 if (bpt == NULL) {
319 return Api::NewError("%s: breakpoint with id %"Pd" does not exist", 319 return Api::NewError("%s: breakpoint with id %" Pd " does not exist",
320 CURRENT_FUNC, bp_id); 320 CURRENT_FUNC, bp_id);
321 } 321 }
322 return Api::NewHandle(isolate, bpt->SourceUrl()); 322 return Api::NewHandle(isolate, bpt->SourceUrl());
323 } 323 }
324 324
325 325
326 DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) { 326 DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) {
327 Isolate* isolate = Isolate::Current(); 327 Isolate* isolate = Isolate::Current();
328 DARTSCOPE(isolate); 328 DARTSCOPE(isolate);
329 Debugger* debugger = isolate->debugger(); 329 Debugger* debugger = isolate->debugger();
330 ASSERT(debugger != NULL); 330 ASSERT(debugger != NULL);
331 331
332 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id); 332 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id);
333 if (bpt == NULL) { 333 if (bpt == NULL) {
334 return Api::NewError("%s: breakpoint with id %"Pd" does not exist", 334 return Api::NewError("%s: breakpoint with id %" Pd " does not exist",
335 CURRENT_FUNC, bp_id); 335 CURRENT_FUNC, bp_id);
336 } 336 }
337 return Dart_NewInteger(bpt->LineNumber()); 337 return Dart_NewInteger(bpt->LineNumber());
338 } 338 }
339 339
340 340
341 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( 341 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
342 Dart_Handle library_in, 342 Dart_Handle library_in,
343 Dart_Handle class_name_in, 343 Dart_Handle class_name_in,
344 Dart_Handle function_name_in) { 344 Dart_Handle function_name_in) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 return Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls)); 471 return Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls));
472 } 472 }
473 473
474 474
475 DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) { 475 DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) {
476 Isolate* isolate = Isolate::Current(); 476 Isolate* isolate = Isolate::Current();
477 DARTSCOPE(isolate); 477 DARTSCOPE(isolate);
478 const Library& lib = 478 const Library& lib =
479 Library::Handle(isolate, Library::GetLibrary(library_id)); 479 Library::Handle(isolate, Library::GetLibrary(library_id));
480 if (lib.IsNull()) { 480 if (lib.IsNull()) {
481 return Api::NewError("%s: %"Pd" is not a valid library id", 481 return Api::NewError("%s: %" Pd " is not a valid library id",
482 CURRENT_FUNC, library_id); 482 CURRENT_FUNC, library_id);
483 } 483 }
484 return Api::NewHandle(isolate, isolate->debugger()->GetLibraryFields(lib)); 484 return Api::NewHandle(isolate, isolate->debugger()->GetLibraryFields(lib));
485 } 485 }
486 486
487 487
488 DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) { 488 DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) {
489 Isolate* isolate = Isolate::Current(); 489 Isolate* isolate = Isolate::Current();
490 ASSERT(isolate != NULL); 490 ASSERT(isolate != NULL);
491 DARTSCOPE(isolate); 491 DARTSCOPE(isolate);
492 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 492 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
493 if (lib.IsNull()) { 493 if (lib.IsNull()) {
494 return Api::NewError("%s: %"Pd" is not a valid library id", 494 return Api::NewError("%s: %" Pd " is not a valid library id",
495 CURRENT_FUNC, library_id); 495 CURRENT_FUNC, library_id);
496 } 496 }
497 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib)); 497 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib));
498 } 498 }
499 499
500 500
501 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target, 501 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target,
502 Dart_Handle expr_in) { 502 Dart_Handle expr_in) {
503 Isolate* isolate = Isolate::Current(); 503 Isolate* isolate = Isolate::Current();
504 DARTSCOPE(isolate); 504 DARTSCOPE(isolate);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 584
585 DART_EXPORT Dart_Handle Dart_GetClassInfo( 585 DART_EXPORT Dart_Handle Dart_GetClassInfo(
586 intptr_t cls_id, 586 intptr_t cls_id,
587 Dart_Handle* class_name, 587 Dart_Handle* class_name,
588 intptr_t* library_id, 588 intptr_t* library_id,
589 intptr_t* super_class_id, 589 intptr_t* super_class_id,
590 Dart_Handle* static_fields) { 590 Dart_Handle* static_fields) {
591 Isolate* isolate = Isolate::Current(); 591 Isolate* isolate = Isolate::Current();
592 DARTSCOPE(isolate); 592 DARTSCOPE(isolate);
593 if (!isolate->class_table()->IsValidIndex(cls_id)) { 593 if (!isolate->class_table()->IsValidIndex(cls_id)) {
594 return Api::NewError("%s: %"Pd" is not a valid class id", 594 return Api::NewError("%s: %" Pd " is not a valid class id",
595 CURRENT_FUNC, cls_id); 595 CURRENT_FUNC, cls_id);
596 } 596 }
597 Class& cls = Class::Handle(isolate, isolate->class_table()->At(cls_id)); 597 Class& cls = Class::Handle(isolate, isolate->class_table()->At(cls_id));
598 if (class_name != NULL) { 598 if (class_name != NULL) {
599 *class_name = Api::NewHandle(isolate, cls.Name()); 599 *class_name = Api::NewHandle(isolate, cls.Name());
600 } 600 }
601 if (library_id != NULL) { 601 if (library_id != NULL) {
602 const Library& lib = Library::Handle(isolate, cls.library()); 602 const Library& lib = Library::Handle(isolate, cls.library());
603 *library_id = lib.index(); 603 *library_id = lib.index();
604 } 604 }
(...skipping 12 matching lines...) Expand all
617 } 617 }
618 618
619 619
620 DART_EXPORT Dart_Handle Dart_ScriptGetSource( 620 DART_EXPORT Dart_Handle Dart_ScriptGetSource(
621 intptr_t library_id, 621 intptr_t library_id,
622 Dart_Handle script_url_in) { 622 Dart_Handle script_url_in) {
623 Isolate* isolate = Isolate::Current(); 623 Isolate* isolate = Isolate::Current();
624 DARTSCOPE(isolate); 624 DARTSCOPE(isolate);
625 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 625 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
626 if (lib.IsNull()) { 626 if (lib.IsNull()) {
627 return Api::NewError("%s: %"Pd" is not a valid library id", 627 return Api::NewError("%s: %" Pd " is not a valid library id",
628 CURRENT_FUNC, library_id); 628 CURRENT_FUNC, library_id);
629 } 629 }
630 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); 630 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
631 const Script& script = Script::Handle(lib.LookupScript(script_url)); 631 const Script& script = Script::Handle(lib.LookupScript(script_url));
632 if (script.IsNull()) { 632 if (script.IsNull()) {
633 return Api::NewError("%s: script '%s' not found in library '%s'", 633 return Api::NewError("%s: script '%s' not found in library '%s'",
634 CURRENT_FUNC, script_url.ToCString(), 634 CURRENT_FUNC, script_url.ToCString(),
635 String::Handle(lib.url()).ToCString()); 635 String::Handle(lib.url()).ToCString());
636 } 636 }
637 return Api::NewHandle(isolate, script.Source()); 637 return Api::NewHandle(isolate, script.Source());
638 } 638 }
639 639
640 640
641 DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo( 641 DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(
642 intptr_t library_id, 642 intptr_t library_id,
643 Dart_Handle script_url_in) { 643 Dart_Handle script_url_in) {
644 Isolate* isolate = Isolate::Current(); 644 Isolate* isolate = Isolate::Current();
645 DARTSCOPE(isolate); 645 DARTSCOPE(isolate);
646 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 646 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
647 if (lib.IsNull()) { 647 if (lib.IsNull()) {
648 return Api::NewError("%s: %"Pd" is not a valid library id", 648 return Api::NewError("%s: %" Pd " is not a valid library id",
649 CURRENT_FUNC, library_id); 649 CURRENT_FUNC, library_id);
650 } 650 }
651 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); 651 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
652 const Script& script = Script::Handle(lib.LookupScript(script_url)); 652 const Script& script = Script::Handle(lib.LookupScript(script_url));
653 if (script.IsNull()) { 653 if (script.IsNull()) {
654 return Api::NewError("%s: script '%s' not found in library '%s'", 654 return Api::NewError("%s: script '%s' not found in library '%s'",
655 CURRENT_FUNC, script_url.ToCString(), 655 CURRENT_FUNC, script_url.ToCString(),
656 String::Handle(lib.url()).ToCString()); 656 String::Handle(lib.url()).ToCString());
657 } 657 }
658 658
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 return Api::NewHandle(isolate, library_id_list.raw()); 759 return Api::NewHandle(isolate, library_id_list.raw());
760 } 760 }
761 761
762 762
763 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { 763 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) {
764 Isolate* isolate = Isolate::Current(); 764 Isolate* isolate = Isolate::Current();
765 ASSERT(isolate != NULL); 765 ASSERT(isolate != NULL);
766 DARTSCOPE(isolate); 766 DARTSCOPE(isolate);
767 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 767 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
768 if (lib.IsNull()) { 768 if (lib.IsNull()) {
769 return Api::NewError("%s: %"Pd" is not a valid library id", 769 return Api::NewError("%s: %" Pd " is not a valid library id",
770 CURRENT_FUNC, library_id); 770 CURRENT_FUNC, library_id);
771 } 771 }
772 const GrowableObjectArray& import_list = 772 const GrowableObjectArray& import_list =
773 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); 773 GrowableObjectArray::Handle(GrowableObjectArray::New(8));
774 774
775 String& prefix_name = String::Handle(isolate); 775 String& prefix_name = String::Handle(isolate);
776 Library& imported = Library::Handle(isolate); 776 Library& imported = Library::Handle(isolate);
777 intptr_t num_imports = lib.num_imports(); 777 intptr_t num_imports = lib.num_imports();
778 for (int i = 0; i < num_imports; i++) { 778 for (int i = 0; i < num_imports; i++) {
779 import_list.Add(prefix_name); // Null prefix name means no prefix. 779 import_list.Add(prefix_name); // Null prefix name means no prefix.
(...skipping 18 matching lines...) Expand all
798 return Api::NewHandle(isolate, Array::MakeArray(import_list)); 798 return Api::NewHandle(isolate, Array::MakeArray(import_list));
799 } 799 }
800 800
801 801
802 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { 802 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) {
803 Isolate* isolate = Isolate::Current(); 803 Isolate* isolate = Isolate::Current();
804 ASSERT(isolate != NULL); 804 ASSERT(isolate != NULL);
805 DARTSCOPE(isolate); 805 DARTSCOPE(isolate);
806 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 806 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
807 if (lib.IsNull()) { 807 if (lib.IsNull()) {
808 return Api::NewError("%s: %"Pd" is not a valid library id", 808 return Api::NewError("%s: %" Pd " is not a valid library id",
809 CURRENT_FUNC, library_id); 809 CURRENT_FUNC, library_id);
810 } 810 }
811 return Api::NewHandle(isolate, lib.url()); 811 return Api::NewHandle(isolate, lib.url());
812 } 812 }
813 813
814 814
815 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, 815 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id,
816 bool* is_debuggable) { 816 bool* is_debuggable) {
817 Isolate* isolate = Isolate::Current(); 817 Isolate* isolate = Isolate::Current();
818 ASSERT(isolate != NULL); 818 ASSERT(isolate != NULL);
819 DARTSCOPE(isolate); 819 DARTSCOPE(isolate);
820 CHECK_NOT_NULL(is_debuggable); 820 CHECK_NOT_NULL(is_debuggable);
821 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 821 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
822 if (lib.IsNull()) { 822 if (lib.IsNull()) {
823 return Api::NewError("%s: %"Pd" is not a valid library id", 823 return Api::NewError("%s: %" Pd " is not a valid library id",
824 CURRENT_FUNC, library_id); 824 CURRENT_FUNC, library_id);
825 } 825 }
826 *is_debuggable = lib.IsDebuggable(); 826 *is_debuggable = lib.IsDebuggable();
827 return Api::Success(); 827 return Api::Success();
828 } 828 }
829 829
830 830
831 DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, 831 DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id,
832 bool is_debuggable) { 832 bool is_debuggable) {
833 Isolate* isolate = Isolate::Current(); 833 Isolate* isolate = Isolate::Current();
834 ASSERT(isolate != NULL); 834 ASSERT(isolate != NULL);
835 DARTSCOPE(isolate); 835 DARTSCOPE(isolate);
836 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); 836 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
837 if (lib.IsNull()) { 837 if (lib.IsNull()) {
838 return Api::NewError("%s: %"Pd" is not a valid library id", 838 return Api::NewError("%s: %" Pd " is not a valid library id",
839 CURRENT_FUNC, library_id); 839 CURRENT_FUNC, library_id);
840 } 840 }
841 lib.set_debuggable(is_debuggable); 841 lib.set_debuggable(is_debuggable);
842 return Api::Success(); 842 return Api::Success();
843 } 843 }
844 844
845 845
846 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { 846 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) {
847 Isolate* isolate = PortMap::GetIsolate(isolate_id); 847 Isolate* isolate = PortMap::GetIsolate(isolate_id);
848 return Api::CastIsolate(isolate); 848 return Api::CastIsolate(isolate);
849 } 849 }
850 850
851 851
852 DART_EXPORT char* Dart_GetVmStatus(const char* request) { 852 DART_EXPORT char* Dart_GetVmStatus(const char* request) {
853 if (strncmp(request, "/isolate/", 9) == 0) { 853 if (strncmp(request, "/isolate/", 9) == 0) {
854 return Isolate::GetStatus(request); 854 return Isolate::GetStatus(request);
855 } 855 }
856 return NULL; 856 return NULL;
857 } 857 }
858 858
859 } // namespace dart 859 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698