OLD | NEW |
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 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 breakpoint_hit = false; | 640 breakpoint_hit = false; |
641 breakpoint_hit_counter = 0; | 641 breakpoint_hit_counter = 0; |
642 Dart_Handle retval = Invoke("main"); | 642 Dart_Handle retval = Invoke("main"); |
643 EXPECT_VALID(retval); | 643 EXPECT_VALID(retval); |
644 EXPECT(Dart_IsInteger(retval)); | 644 EXPECT(Dart_IsInteger(retval)); |
645 int64_t int_value = ToInt64(retval); | 645 int64_t int_value = ToInt64(retval); |
646 EXPECT_EQ(2, int_value); | 646 EXPECT_EQ(2, int_value); |
647 EXPECT(breakpoint_hit == true); | 647 EXPECT(breakpoint_hit == true); |
648 } | 648 } |
649 | 649 |
| 650 static const char* step_into_expected_bpts[] = { |
| 651 "main", |
| 652 "foo", |
| 653 "f1", |
| 654 "foo", |
| 655 "X.X.", |
| 656 "X.X.", |
| 657 "foo", |
| 658 "X.kvmk", |
| 659 "f2", |
| 660 "X.kvmk", |
| 661 "X.kvmk", |
| 662 "foo", |
| 663 "main" |
| 664 }; |
650 | 665 |
651 void TestStepIntoHandler(Dart_IsolateId isolate_id, | 666 void TestStepIntoHandler(Dart_IsolateId isolate_id, |
652 intptr_t bp_id, | 667 intptr_t bp_id, |
653 const Dart_CodeLocation& location) { | 668 const Dart_CodeLocation& location) { |
654 Dart_StackTrace trace; | 669 Dart_StackTrace trace; |
655 Dart_GetStackTrace(&trace); | 670 Dart_GetStackTrace(&trace); |
656 const char* expected_bpts[] = { | 671 const intptr_t expected_bpts_length = ARRAY_SIZE(step_into_expected_bpts); |
657 "main", | |
658 "foo", | |
659 "f1", | |
660 "foo", | |
661 "X.X.", | |
662 "X.X.", | |
663 "foo", | |
664 "X.kvmk", | |
665 "f2", | |
666 "X.kvmk", | |
667 "X.kvmk", | |
668 "foo", | |
669 "main" | |
670 }; | |
671 const intptr_t expected_bpts_length = ARRAY_SIZE(expected_bpts); | |
672 intptr_t trace_len; | 672 intptr_t trace_len; |
673 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); | 673 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); |
674 EXPECT_VALID(res); | 674 EXPECT_VALID(res); |
675 EXPECT(breakpoint_hit_counter < expected_bpts_length); | 675 EXPECT(breakpoint_hit_counter < expected_bpts_length); |
676 Dart_ActivationFrame frame; | 676 Dart_ActivationFrame frame; |
677 res = Dart_GetActivationFrame(trace, 0, &frame); | 677 res = Dart_GetActivationFrame(trace, 0, &frame); |
678 EXPECT_VALID(res); | 678 EXPECT_VALID(res); |
679 Dart_Handle func_name; | 679 Dart_Handle func_name; |
680 res = Dart_ActivationFrameInfo(frame, &func_name, NULL, NULL, NULL); | 680 res = Dart_ActivationFrameInfo(frame, &func_name, NULL, NULL, NULL); |
681 EXPECT_VALID(res); | 681 EXPECT_VALID(res); |
682 EXPECT(Dart_IsString(func_name)); | 682 EXPECT(Dart_IsString(func_name)); |
683 const char* name_chars; | 683 const char* name_chars; |
684 Dart_StringToCString(func_name, &name_chars); | 684 Dart_StringToCString(func_name, &name_chars); |
685 if (breakpoint_hit_counter < expected_bpts_length) { | 685 if (breakpoint_hit_counter < expected_bpts_length) { |
686 EXPECT_STREQ(expected_bpts[breakpoint_hit_counter], name_chars); | 686 EXPECT_STREQ(step_into_expected_bpts[breakpoint_hit_counter], name_chars); |
687 } | 687 } |
688 if (verbose) { | 688 if (verbose) { |
689 OS::Print(" >> bpt nr %d: %s\n", breakpoint_hit_counter, name_chars); | 689 OS::Print(" >> bpt nr %d: %s\n", breakpoint_hit_counter, name_chars); |
690 } | 690 } |
691 breakpoint_hit = true; | 691 breakpoint_hit = true; |
692 breakpoint_hit_counter++; | 692 breakpoint_hit_counter++; |
693 Dart_SetStepInto(); | 693 Dart_SetStepInto(); |
694 } | 694 } |
695 | 695 |
696 | 696 |
(...skipping 23 matching lines...) Expand all Loading... |
720 | 720 |
721 SetBreakpointAtEntry("", "main"); | 721 SetBreakpointAtEntry("", "main"); |
722 breakpoint_hit = false; | 722 breakpoint_hit = false; |
723 breakpoint_hit_counter = 0; | 723 breakpoint_hit_counter = 0; |
724 Dart_Handle retval = Invoke("main"); | 724 Dart_Handle retval = Invoke("main"); |
725 EXPECT_VALID(retval); | 725 EXPECT_VALID(retval); |
726 EXPECT(Dart_IsInteger(retval)); | 726 EXPECT(Dart_IsInteger(retval)); |
727 int64_t int_value = ToInt64(retval); | 727 int64_t int_value = ToInt64(retval); |
728 EXPECT_EQ(7, int_value); | 728 EXPECT_EQ(7, int_value); |
729 EXPECT(breakpoint_hit == true); | 729 EXPECT(breakpoint_hit == true); |
| 730 EXPECT(breakpoint_hit_counter == ARRAY_SIZE(step_into_expected_bpts)); |
730 } | 731 } |
731 | 732 |
732 | 733 |
733 static void StepIntoHandler(Dart_IsolateId isolate_id, | 734 static void StepIntoHandler(Dart_IsolateId isolate_id, |
734 intptr_t bp_id, | 735 intptr_t bp_id, |
735 const Dart_CodeLocation& location) { | 736 const Dart_CodeLocation& location) { |
736 Dart_StackTrace trace; | 737 Dart_StackTrace trace; |
737 Dart_GetStackTrace(&trace); | 738 Dart_GetStackTrace(&trace); |
738 if (verbose) { | 739 if (verbose) { |
739 OS::Print(">>> Breakpoint nr. %d in %s <<<\n", | 740 OS::Print(">>> Breakpoint nr. %d in %s <<<\n", |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2062 | 2063 |
2063 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); | 2064 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); |
2064 Dart_Handle super_type = Dart_GetSupertype(list_type); | 2065 Dart_Handle super_type = Dart_GetSupertype(list_type); |
2065 EXPECT(!Dart_IsError(super_type)); | 2066 EXPECT(!Dart_IsError(super_type)); |
2066 super_type = Dart_GetSupertype(super_type); | 2067 super_type = Dart_GetSupertype(super_type); |
2067 EXPECT(!Dart_IsError(super_type)); | 2068 EXPECT(!Dart_IsError(super_type)); |
2068 EXPECT(super_type == Dart_Null()); | 2069 EXPECT(super_type == Dart_Null()); |
2069 } | 2070 } |
2070 | 2071 |
2071 } // namespace dart | 2072 } // namespace dart |
OLD | NEW |