OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 CHECK(!HasDebugInfo(foo)); | 816 CHECK(!HasDebugInfo(foo)); |
817 CHECK(!HasDebugInfo(bar)); | 817 CHECK(!HasDebugInfo(bar)); |
818 } | 818 } |
819 | 819 |
820 | 820 |
821 // Test that a break point can be set at an IC store location. | 821 // Test that a break point can be set at an IC store location. |
822 TEST(BreakPointICStore) { | 822 TEST(BreakPointICStore) { |
823 break_point_hit_count = 0; | 823 break_point_hit_count = 0; |
824 v8::HandleScope scope; | 824 v8::HandleScope scope; |
825 DebugLocalContext env; | 825 DebugLocalContext env; |
826 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 826 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
827 v8::Undefined()); | 827 v8::Undefined()); |
828 v8::Script::Compile(v8::String::New("function foo(){bar=0;}"))->Run(); | 828 v8::Script::Compile(v8::String::New("function foo(){bar=0;}"))->Run(); |
829 v8::Local<v8::Function> foo = | 829 v8::Local<v8::Function> foo = |
830 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); | 830 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); |
831 | 831 |
832 // Run without breakpoints. | 832 // Run without breakpoints. |
833 foo->Call(env->Global(), 0, NULL); | 833 foo->Call(env->Global(), 0, NULL); |
834 CHECK_EQ(0, break_point_hit_count); | 834 CHECK_EQ(0, break_point_hit_count); |
835 | 835 |
836 // Run with breakpoint | 836 // Run with breakpoint |
837 int bp = SetBreakPoint(foo, 0); | 837 int bp = SetBreakPoint(foo, 0); |
838 foo->Call(env->Global(), 0, NULL); | 838 foo->Call(env->Global(), 0, NULL); |
839 CHECK_EQ(1, break_point_hit_count); | 839 CHECK_EQ(1, break_point_hit_count); |
840 foo->Call(env->Global(), 0, NULL); | 840 foo->Call(env->Global(), 0, NULL); |
841 CHECK_EQ(2, break_point_hit_count); | 841 CHECK_EQ(2, break_point_hit_count); |
842 | 842 |
843 // Run without breakpoints. | 843 // Run without breakpoints. |
844 ClearBreakPoint(bp); | 844 ClearBreakPoint(bp); |
845 foo->Call(env->Global(), 0, NULL); | 845 foo->Call(env->Global(), 0, NULL); |
846 CHECK_EQ(2, break_point_hit_count); | 846 CHECK_EQ(2, break_point_hit_count); |
847 | 847 |
848 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 848 v8::Debug::SetDebugEventListener(NULL); |
849 } | 849 } |
850 | 850 |
851 | 851 |
852 // Test that a break point can be set at an IC load location. | 852 // Test that a break point can be set at an IC load location. |
853 TEST(BreakPointICLoad) { | 853 TEST(BreakPointICLoad) { |
854 break_point_hit_count = 0; | 854 break_point_hit_count = 0; |
855 v8::HandleScope scope; | 855 v8::HandleScope scope; |
856 DebugLocalContext env; | 856 DebugLocalContext env; |
857 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 857 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
858 v8::Undefined()); | 858 v8::Undefined()); |
859 v8::Script::Compile(v8::String::New("bar=1"))->Run(); | 859 v8::Script::Compile(v8::String::New("bar=1"))->Run(); |
860 v8::Script::Compile(v8::String::New("function foo(){var x=bar;}"))->Run(); | 860 v8::Script::Compile(v8::String::New("function foo(){var x=bar;}"))->Run(); |
861 v8::Local<v8::Function> foo = | 861 v8::Local<v8::Function> foo = |
862 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); | 862 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); |
863 | 863 |
864 // Run without breakpoints. | 864 // Run without breakpoints. |
865 foo->Call(env->Global(), 0, NULL); | 865 foo->Call(env->Global(), 0, NULL); |
866 CHECK_EQ(0, break_point_hit_count); | 866 CHECK_EQ(0, break_point_hit_count); |
867 | 867 |
868 // Run with breakpoint | 868 // Run with breakpoint |
869 int bp = SetBreakPoint(foo, 0); | 869 int bp = SetBreakPoint(foo, 0); |
870 foo->Call(env->Global(), 0, NULL); | 870 foo->Call(env->Global(), 0, NULL); |
871 CHECK_EQ(1, break_point_hit_count); | 871 CHECK_EQ(1, break_point_hit_count); |
872 foo->Call(env->Global(), 0, NULL); | 872 foo->Call(env->Global(), 0, NULL); |
873 CHECK_EQ(2, break_point_hit_count); | 873 CHECK_EQ(2, break_point_hit_count); |
874 | 874 |
875 // Run without breakpoints. | 875 // Run without breakpoints. |
876 ClearBreakPoint(bp); | 876 ClearBreakPoint(bp); |
877 foo->Call(env->Global(), 0, NULL); | 877 foo->Call(env->Global(), 0, NULL); |
878 CHECK_EQ(2, break_point_hit_count); | 878 CHECK_EQ(2, break_point_hit_count); |
879 | 879 |
880 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 880 v8::Debug::SetDebugEventListener(NULL); |
881 } | 881 } |
882 | 882 |
883 | 883 |
884 // Test that a break point can be set at an IC call location. | 884 // Test that a break point can be set at an IC call location. |
885 TEST(BreakPointICCall) { | 885 TEST(BreakPointICCall) { |
886 break_point_hit_count = 0; | 886 break_point_hit_count = 0; |
887 v8::HandleScope scope; | 887 v8::HandleScope scope; |
888 DebugLocalContext env; | 888 DebugLocalContext env; |
889 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 889 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
890 v8::Undefined()); | 890 v8::Undefined()); |
891 v8::Script::Compile(v8::String::New("function bar(){}"))->Run(); | 891 v8::Script::Compile(v8::String::New("function bar(){}"))->Run(); |
892 v8::Script::Compile(v8::String::New("function foo(){bar();}"))->Run(); | 892 v8::Script::Compile(v8::String::New("function foo(){bar();}"))->Run(); |
893 v8::Local<v8::Function> foo = | 893 v8::Local<v8::Function> foo = |
894 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); | 894 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); |
895 | 895 |
896 // Run without breakpoints. | 896 // Run without breakpoints. |
897 foo->Call(env->Global(), 0, NULL); | 897 foo->Call(env->Global(), 0, NULL); |
898 CHECK_EQ(0, break_point_hit_count); | 898 CHECK_EQ(0, break_point_hit_count); |
899 | 899 |
900 // Run with breakpoint | 900 // Run with breakpoint |
901 int bp = SetBreakPoint(foo, 0); | 901 int bp = SetBreakPoint(foo, 0); |
902 foo->Call(env->Global(), 0, NULL); | 902 foo->Call(env->Global(), 0, NULL); |
903 CHECK_EQ(1, break_point_hit_count); | 903 CHECK_EQ(1, break_point_hit_count); |
904 foo->Call(env->Global(), 0, NULL); | 904 foo->Call(env->Global(), 0, NULL); |
905 CHECK_EQ(2, break_point_hit_count); | 905 CHECK_EQ(2, break_point_hit_count); |
906 | 906 |
907 // Run without breakpoints. | 907 // Run without breakpoints. |
908 ClearBreakPoint(bp); | 908 ClearBreakPoint(bp); |
909 foo->Call(env->Global(), 0, NULL); | 909 foo->Call(env->Global(), 0, NULL); |
910 CHECK_EQ(2, break_point_hit_count); | 910 CHECK_EQ(2, break_point_hit_count); |
911 | 911 |
912 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 912 v8::Debug::SetDebugEventListener(NULL); |
913 } | 913 } |
914 | 914 |
915 | 915 |
916 // Test that a break point can be set at a return store location. | 916 // Test that a break point can be set at a return store location. |
917 TEST(BreakPointReturn) { | 917 TEST(BreakPointReturn) { |
918 break_point_hit_count = 0; | 918 break_point_hit_count = 0; |
919 v8::HandleScope scope; | 919 v8::HandleScope scope; |
920 DebugLocalContext env; | 920 DebugLocalContext env; |
921 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 921 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
922 v8::Undefined()); | 922 v8::Undefined()); |
923 v8::Script::Compile(v8::String::New("function foo(){}"))->Run(); | 923 v8::Script::Compile(v8::String::New("function foo(){}"))->Run(); |
924 v8::Local<v8::Function> foo = | 924 v8::Local<v8::Function> foo = |
925 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); | 925 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); |
926 | 926 |
927 // Run without breakpoints. | 927 // Run without breakpoints. |
928 foo->Call(env->Global(), 0, NULL); | 928 foo->Call(env->Global(), 0, NULL); |
929 CHECK_EQ(0, break_point_hit_count); | 929 CHECK_EQ(0, break_point_hit_count); |
930 | 930 |
931 // Run with breakpoint | 931 // Run with breakpoint |
932 int bp = SetBreakPoint(foo, 0); | 932 int bp = SetBreakPoint(foo, 0); |
933 foo->Call(env->Global(), 0, NULL); | 933 foo->Call(env->Global(), 0, NULL); |
934 CHECK_EQ(1, break_point_hit_count); | 934 CHECK_EQ(1, break_point_hit_count); |
935 foo->Call(env->Global(), 0, NULL); | 935 foo->Call(env->Global(), 0, NULL); |
936 CHECK_EQ(2, break_point_hit_count); | 936 CHECK_EQ(2, break_point_hit_count); |
937 | 937 |
938 // Run without breakpoints. | 938 // Run without breakpoints. |
939 ClearBreakPoint(bp); | 939 ClearBreakPoint(bp); |
940 foo->Call(env->Global(), 0, NULL); | 940 foo->Call(env->Global(), 0, NULL); |
941 CHECK_EQ(2, break_point_hit_count); | 941 CHECK_EQ(2, break_point_hit_count); |
942 | 942 |
943 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 943 v8::Debug::SetDebugEventListener(NULL); |
944 } | 944 } |
945 | 945 |
946 | 946 |
947 static void CallWithBreakPoints(v8::Local<v8::Object> recv, | 947 static void CallWithBreakPoints(v8::Local<v8::Object> recv, |
948 v8::Local<v8::Function> f, | 948 v8::Local<v8::Function> f, |
949 int break_point_count, | 949 int break_point_count, |
950 int call_count) { | 950 int call_count) { |
951 break_point_hit_count = 0; | 951 break_point_hit_count = 0; |
952 for (int i = 0; i < call_count; i++) { | 952 for (int i = 0; i < call_count; i++) { |
953 f->Call(recv, 0, NULL); | 953 f->Call(recv, 0, NULL); |
954 CHECK_EQ((i + 1) * break_point_count, break_point_hit_count); | 954 CHECK_EQ((i + 1) * break_point_count, break_point_hit_count); |
955 } | 955 } |
956 } | 956 } |
957 | 957 |
958 // Test GC during break point processing. | 958 // Test GC during break point processing. |
959 TEST(GCDuringBreakPointProcessing) { | 959 TEST(GCDuringBreakPointProcessing) { |
960 break_point_hit_count = 0; | 960 break_point_hit_count = 0; |
961 v8::HandleScope scope; | 961 v8::HandleScope scope; |
962 DebugLocalContext env; | 962 DebugLocalContext env; |
963 | 963 |
964 v8::Debug::AddDebugEventListener(DebugEventBreakPointCollectGarbage, | 964 v8::Debug::SetDebugEventListener(DebugEventBreakPointCollectGarbage, |
965 v8::Undefined()); | 965 v8::Undefined()); |
966 v8::Local<v8::Function> foo; | 966 v8::Local<v8::Function> foo; |
967 | 967 |
968 // Test IC store break point with garbage collection. | 968 // Test IC store break point with garbage collection. |
969 foo = CompileFunction(&env, "function foo(){bar=0;}", "foo"); | 969 foo = CompileFunction(&env, "function foo(){bar=0;}", "foo"); |
970 SetBreakPoint(foo, 0); | 970 SetBreakPoint(foo, 0); |
971 CallWithBreakPoints(env->Global(), foo, 1, 10); | 971 CallWithBreakPoints(env->Global(), foo, 1, 10); |
972 | 972 |
973 // Test IC load break point with garbage collection. | 973 // Test IC load break point with garbage collection. |
974 foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo"); | 974 foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo"); |
975 SetBreakPoint(foo, 0); | 975 SetBreakPoint(foo, 0); |
976 CallWithBreakPoints(env->Global(), foo, 1, 10); | 976 CallWithBreakPoints(env->Global(), foo, 1, 10); |
977 | 977 |
978 // Test IC call break point with garbage collection. | 978 // Test IC call break point with garbage collection. |
979 foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo"); | 979 foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo"); |
980 SetBreakPoint(foo, 0); | 980 SetBreakPoint(foo, 0); |
981 CallWithBreakPoints(env->Global(), foo, 1, 10); | 981 CallWithBreakPoints(env->Global(), foo, 1, 10); |
982 | 982 |
983 // Test return break point with garbage collection. | 983 // Test return break point with garbage collection. |
984 foo = CompileFunction(&env, "function foo(){}", "foo"); | 984 foo = CompileFunction(&env, "function foo(){}", "foo"); |
985 SetBreakPoint(foo, 0); | 985 SetBreakPoint(foo, 0); |
986 CallWithBreakPoints(env->Global(), foo, 1, 25); | 986 CallWithBreakPoints(env->Global(), foo, 1, 25); |
987 | 987 |
988 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointCollectGarbage); | 988 v8::Debug::SetDebugEventListener(NULL); |
989 } | 989 } |
990 | 990 |
991 | 991 |
992 // Call the function three times with different garbage collections in between | 992 // Call the function three times with different garbage collections in between |
993 // and make sure that the break point survives. | 993 // and make sure that the break point survives. |
994 static void CallAndGC(v8::Local<v8::Object> recv, v8::Local<v8::Function> f) { | 994 static void CallAndGC(v8::Local<v8::Object> recv, v8::Local<v8::Function> f) { |
995 break_point_hit_count = 0; | 995 break_point_hit_count = 0; |
996 | 996 |
997 for (int i = 0; i < 3; i++) { | 997 for (int i = 0; i < 3; i++) { |
998 // Call function. | 998 // Call function. |
(...skipping 12 matching lines...) Expand all Loading... |
1011 } | 1011 } |
1012 } | 1012 } |
1013 | 1013 |
1014 | 1014 |
1015 // Test that a break point can be set at a return store location. | 1015 // Test that a break point can be set at a return store location. |
1016 TEST(BreakPointSurviveGC) { | 1016 TEST(BreakPointSurviveGC) { |
1017 break_point_hit_count = 0; | 1017 break_point_hit_count = 0; |
1018 v8::HandleScope scope; | 1018 v8::HandleScope scope; |
1019 DebugLocalContext env; | 1019 DebugLocalContext env; |
1020 | 1020 |
1021 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1021 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1022 v8::Undefined()); | 1022 v8::Undefined()); |
1023 v8::Local<v8::Function> foo; | 1023 v8::Local<v8::Function> foo; |
1024 | 1024 |
1025 // Test IC store break point with garbage collection. | 1025 // Test IC store break point with garbage collection. |
1026 foo = CompileFunction(&env, "function foo(){bar=0;}", "foo"); | 1026 foo = CompileFunction(&env, "function foo(){bar=0;}", "foo"); |
1027 SetBreakPoint(foo, 0); | 1027 SetBreakPoint(foo, 0); |
1028 CallAndGC(env->Global(), foo); | 1028 CallAndGC(env->Global(), foo); |
1029 | 1029 |
1030 // Test IC load break point with garbage collection. | 1030 // Test IC load break point with garbage collection. |
1031 foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo"); | 1031 foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo"); |
1032 SetBreakPoint(foo, 0); | 1032 SetBreakPoint(foo, 0); |
1033 CallAndGC(env->Global(), foo); | 1033 CallAndGC(env->Global(), foo); |
1034 | 1034 |
1035 // Test IC call break point with garbage collection. | 1035 // Test IC call break point with garbage collection. |
1036 foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo"); | 1036 foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo"); |
1037 SetBreakPoint(foo, 0); | 1037 SetBreakPoint(foo, 0); |
1038 CallAndGC(env->Global(), foo); | 1038 CallAndGC(env->Global(), foo); |
1039 | 1039 |
1040 // Test return break point with garbage collection. | 1040 // Test return break point with garbage collection. |
1041 foo = CompileFunction(&env, "function foo(){}", "foo"); | 1041 foo = CompileFunction(&env, "function foo(){}", "foo"); |
1042 SetBreakPoint(foo, 0); | 1042 SetBreakPoint(foo, 0); |
1043 CallAndGC(env->Global(), foo); | 1043 CallAndGC(env->Global(), foo); |
1044 | 1044 |
1045 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1045 v8::Debug::SetDebugEventListener(NULL); |
1046 } | 1046 } |
1047 | 1047 |
1048 | 1048 |
1049 // Test that break points can be set using the global Debug object. | 1049 // Test that break points can be set using the global Debug object. |
1050 TEST(BreakPointThroughJavaScript) { | 1050 TEST(BreakPointThroughJavaScript) { |
1051 break_point_hit_count = 0; | 1051 break_point_hit_count = 0; |
1052 v8::HandleScope scope; | 1052 v8::HandleScope scope; |
1053 DebugLocalContext env; | 1053 DebugLocalContext env; |
1054 env.ExposeDebug(); | 1054 env.ExposeDebug(); |
1055 | 1055 |
1056 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1056 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1057 v8::Undefined()); | 1057 v8::Undefined()); |
1058 v8::Script::Compile(v8::String::New("function bar(){}"))->Run(); | 1058 v8::Script::Compile(v8::String::New("function bar(){}"))->Run(); |
1059 v8::Script::Compile(v8::String::New("function foo(){bar();bar();}"))->Run(); | 1059 v8::Script::Compile(v8::String::New("function foo(){bar();bar();}"))->Run(); |
1060 // 012345678901234567890 | 1060 // 012345678901234567890 |
1061 // 1 2 | 1061 // 1 2 |
1062 // Break points are set at position 3 and 9 | 1062 // Break points are set at position 3 and 9 |
1063 v8::Local<v8::Script> foo = v8::Script::Compile(v8::String::New("foo()")); | 1063 v8::Local<v8::Script> foo = v8::Script::Compile(v8::String::New("foo()")); |
1064 | 1064 |
1065 // Run without breakpoints. | 1065 // Run without breakpoints. |
1066 foo->Run(); | 1066 foo->Run(); |
(...skipping 18 matching lines...) Expand all Loading... |
1085 foo->Run(); | 1085 foo->Run(); |
1086 CHECK_EQ(7, break_point_hit_count); | 1086 CHECK_EQ(7, break_point_hit_count); |
1087 foo->Run(); | 1087 foo->Run(); |
1088 CHECK_EQ(8, break_point_hit_count); | 1088 CHECK_EQ(8, break_point_hit_count); |
1089 | 1089 |
1090 // Run without breakpoints. | 1090 // Run without breakpoints. |
1091 ClearBreakPointFromJS(bp1); | 1091 ClearBreakPointFromJS(bp1); |
1092 foo->Run(); | 1092 foo->Run(); |
1093 CHECK_EQ(8, break_point_hit_count); | 1093 CHECK_EQ(8, break_point_hit_count); |
1094 | 1094 |
1095 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1095 v8::Debug::SetDebugEventListener(NULL); |
1096 | 1096 |
1097 // Make sure that the break point numbers are consecutive. | 1097 // Make sure that the break point numbers are consecutive. |
1098 CHECK_EQ(1, bp1); | 1098 CHECK_EQ(1, bp1); |
1099 CHECK_EQ(2, bp2); | 1099 CHECK_EQ(2, bp2); |
1100 } | 1100 } |
1101 | 1101 |
1102 | 1102 |
1103 // Test that break points can be set using the global Debug object. | 1103 // Test that break points can be set using the global Debug object. |
1104 TEST(ScriptBreakPointThroughJavaScript) { | 1104 TEST(ScriptBreakPointThroughJavaScript) { |
1105 break_point_hit_count = 0; | 1105 break_point_hit_count = 0; |
1106 v8::HandleScope scope; | 1106 v8::HandleScope scope; |
1107 DebugLocalContext env; | 1107 DebugLocalContext env; |
1108 env.ExposeDebug(); | 1108 env.ExposeDebug(); |
1109 | 1109 |
1110 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1110 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1111 v8::Undefined()); | 1111 v8::Undefined()); |
1112 v8::Script::Compile(v8::String::New("function foo(){bar();bar();}"))->Run(); | 1112 v8::Script::Compile(v8::String::New("function foo(){bar();bar();}"))->Run(); |
1113 | 1113 |
1114 v8::Local<v8::String> script = v8::String::New( | 1114 v8::Local<v8::String> script = v8::String::New( |
1115 "function f() {\n" | 1115 "function f() {\n" |
1116 " function h() {\n" | 1116 " function h() {\n" |
1117 " a = 0; // line 2\n" | 1117 " a = 0; // line 2\n" |
1118 " }\n" | 1118 " }\n" |
1119 " b = 1; // line 4\n" | 1119 " b = 1; // line 4\n" |
1120 " return h();\n" | 1120 " return h();\n" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 CHECK_EQ(1, break_point_hit_count); | 1199 CHECK_EQ(1, break_point_hit_count); |
1200 | 1200 |
1201 // Reload the script and get g again checking that the break point survives. | 1201 // Reload the script and get g again checking that the break point survives. |
1202 // This tests that the function break point was converted to a script break | 1202 // This tests that the function break point was converted to a script break |
1203 // point. | 1203 // point. |
1204 v8::Script::Compile(script, &origin)->Run(); | 1204 v8::Script::Compile(script, &origin)->Run(); |
1205 g = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g"))); | 1205 g = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g"))); |
1206 g->Call(env->Global(), 0, NULL); | 1206 g->Call(env->Global(), 0, NULL); |
1207 CHECK_EQ(2, break_point_hit_count); | 1207 CHECK_EQ(2, break_point_hit_count); |
1208 | 1208 |
1209 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1209 v8::Debug::SetDebugEventListener(NULL); |
1210 | 1210 |
1211 // Make sure that the break point numbers are consecutive. | 1211 // Make sure that the break point numbers are consecutive. |
1212 CHECK_EQ(1, sbp1); | 1212 CHECK_EQ(1, sbp1); |
1213 CHECK_EQ(2, sbp2); | 1213 CHECK_EQ(2, sbp2); |
1214 CHECK_EQ(3, sbp3); | 1214 CHECK_EQ(3, sbp3); |
1215 CHECK_EQ(4, sbp4); | 1215 CHECK_EQ(4, sbp4); |
1216 CHECK_EQ(5, sbp5); | 1216 CHECK_EQ(5, sbp5); |
1217 CHECK_EQ(6, sbp6); | 1217 CHECK_EQ(6, sbp6); |
1218 CHECK_EQ(7, bp7); | 1218 CHECK_EQ(7, bp7); |
1219 } | 1219 } |
1220 | 1220 |
1221 | 1221 |
1222 // Test conditional script break points. | 1222 // Test conditional script break points. |
1223 TEST(EnableDisableScriptBreakPoint) { | 1223 TEST(EnableDisableScriptBreakPoint) { |
1224 break_point_hit_count = 0; | 1224 break_point_hit_count = 0; |
1225 v8::HandleScope scope; | 1225 v8::HandleScope scope; |
1226 DebugLocalContext env; | 1226 DebugLocalContext env; |
1227 env.ExposeDebug(); | 1227 env.ExposeDebug(); |
1228 | 1228 |
1229 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1229 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1230 v8::Undefined()); | 1230 v8::Undefined()); |
1231 | 1231 |
1232 v8::Local<v8::String> script = v8::String::New( | 1232 v8::Local<v8::String> script = v8::String::New( |
1233 "function f() {\n" | 1233 "function f() {\n" |
1234 " a = 0; // line 1\n" | 1234 " a = 0; // line 1\n" |
1235 "};"); | 1235 "};"); |
1236 | 1236 |
1237 // Compile the script and get function f. | 1237 // Compile the script and get function f. |
1238 v8::ScriptOrigin origin = | 1238 v8::ScriptOrigin origin = |
1239 v8::ScriptOrigin(v8::String::New("test")); | 1239 v8::ScriptOrigin(v8::String::New("test")); |
(...skipping 24 matching lines...) Expand all Loading... |
1264 // Reload the script and get f again checking that the disabeling survives. | 1264 // Reload the script and get f again checking that the disabeling survives. |
1265 v8::Script::Compile(script, &origin)->Run(); | 1265 v8::Script::Compile(script, &origin)->Run(); |
1266 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 1266 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); |
1267 f->Call(env->Global(), 0, NULL); | 1267 f->Call(env->Global(), 0, NULL); |
1268 CHECK_EQ(2, break_point_hit_count); | 1268 CHECK_EQ(2, break_point_hit_count); |
1269 | 1269 |
1270 EnableScriptBreakPointFromJS(sbp); | 1270 EnableScriptBreakPointFromJS(sbp); |
1271 f->Call(env->Global(), 0, NULL); | 1271 f->Call(env->Global(), 0, NULL); |
1272 CHECK_EQ(3, break_point_hit_count); | 1272 CHECK_EQ(3, break_point_hit_count); |
1273 | 1273 |
1274 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1274 v8::Debug::SetDebugEventListener(NULL); |
1275 } | 1275 } |
1276 | 1276 |
1277 | 1277 |
1278 // Test conditional script break points. | 1278 // Test conditional script break points. |
1279 TEST(ConditionalScriptBreakPoint) { | 1279 TEST(ConditionalScriptBreakPoint) { |
1280 break_point_hit_count = 0; | 1280 break_point_hit_count = 0; |
1281 v8::HandleScope scope; | 1281 v8::HandleScope scope; |
1282 DebugLocalContext env; | 1282 DebugLocalContext env; |
1283 env.ExposeDebug(); | 1283 env.ExposeDebug(); |
1284 | 1284 |
1285 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1285 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1286 v8::Undefined()); | 1286 v8::Undefined()); |
1287 | 1287 |
1288 v8::Local<v8::String> script = v8::String::New( | 1288 v8::Local<v8::String> script = v8::String::New( |
1289 "count = 0;\n" | 1289 "count = 0;\n" |
1290 "function f() {\n" | 1290 "function f() {\n" |
1291 " g(count++); // line 2\n" | 1291 " g(count++); // line 2\n" |
1292 "};\n" | 1292 "};\n" |
1293 "function g(x) {\n" | 1293 "function g(x) {\n" |
1294 " var a=x; // line 5\n" | 1294 " var a=x; // line 5\n" |
1295 "};"); | 1295 "};"); |
(...skipping 29 matching lines...) Expand all Loading... |
1325 // Reload the script and get f again checking that the condition survives. | 1325 // Reload the script and get f again checking that the condition survives. |
1326 v8::Script::Compile(script, &origin)->Run(); | 1326 v8::Script::Compile(script, &origin)->Run(); |
1327 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 1327 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); |
1328 | 1328 |
1329 break_point_hit_count = 0; | 1329 break_point_hit_count = 0; |
1330 for (int i = 0; i < 10; i++) { | 1330 for (int i = 0; i < 10; i++) { |
1331 f->Call(env->Global(), 0, NULL); | 1331 f->Call(env->Global(), 0, NULL); |
1332 } | 1332 } |
1333 CHECK_EQ(5, break_point_hit_count); | 1333 CHECK_EQ(5, break_point_hit_count); |
1334 | 1334 |
1335 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1335 v8::Debug::SetDebugEventListener(NULL); |
1336 } | 1336 } |
1337 | 1337 |
1338 | 1338 |
1339 // Test ignore count on script break points. | 1339 // Test ignore count on script break points. |
1340 TEST(ScriptBreakPointIgnoreCount) { | 1340 TEST(ScriptBreakPointIgnoreCount) { |
1341 break_point_hit_count = 0; | 1341 break_point_hit_count = 0; |
1342 v8::HandleScope scope; | 1342 v8::HandleScope scope; |
1343 DebugLocalContext env; | 1343 DebugLocalContext env; |
1344 env.ExposeDebug(); | 1344 env.ExposeDebug(); |
1345 | 1345 |
1346 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1346 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1347 v8::Undefined()); | 1347 v8::Undefined()); |
1348 | 1348 |
1349 v8::Local<v8::String> script = v8::String::New( | 1349 v8::Local<v8::String> script = v8::String::New( |
1350 "function f() {\n" | 1350 "function f() {\n" |
1351 " a = 0; // line 1\n" | 1351 " a = 0; // line 1\n" |
1352 "};"); | 1352 "};"); |
1353 | 1353 |
1354 // Compile the script and get function f. | 1354 // Compile the script and get function f. |
1355 v8::ScriptOrigin origin = | 1355 v8::ScriptOrigin origin = |
1356 v8::ScriptOrigin(v8::String::New("test")); | 1356 v8::ScriptOrigin(v8::String::New("test")); |
(...skipping 22 matching lines...) Expand all Loading... |
1379 // Reload the script and get f again checking that the ignore survives. | 1379 // Reload the script and get f again checking that the ignore survives. |
1380 v8::Script::Compile(script, &origin)->Run(); | 1380 v8::Script::Compile(script, &origin)->Run(); |
1381 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 1381 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); |
1382 | 1382 |
1383 break_point_hit_count = 0; | 1383 break_point_hit_count = 0; |
1384 for (int i = 0; i < 10; i++) { | 1384 for (int i = 0; i < 10; i++) { |
1385 f->Call(env->Global(), 0, NULL); | 1385 f->Call(env->Global(), 0, NULL); |
1386 } | 1386 } |
1387 CHECK_EQ(5, break_point_hit_count); | 1387 CHECK_EQ(5, break_point_hit_count); |
1388 | 1388 |
1389 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1389 v8::Debug::SetDebugEventListener(NULL); |
1390 } | 1390 } |
1391 | 1391 |
1392 | 1392 |
1393 // Test that script break points survive when a script is reloaded. | 1393 // Test that script break points survive when a script is reloaded. |
1394 TEST(ScriptBreakPointReload) { | 1394 TEST(ScriptBreakPointReload) { |
1395 break_point_hit_count = 0; | 1395 break_point_hit_count = 0; |
1396 v8::HandleScope scope; | 1396 v8::HandleScope scope; |
1397 DebugLocalContext env; | 1397 DebugLocalContext env; |
1398 env.ExposeDebug(); | 1398 env.ExposeDebug(); |
1399 | 1399 |
1400 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1400 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1401 v8::Undefined()); | 1401 v8::Undefined()); |
1402 | 1402 |
1403 v8::Local<v8::Function> f; | 1403 v8::Local<v8::Function> f; |
1404 v8::Local<v8::String> script = v8::String::New( | 1404 v8::Local<v8::String> script = v8::String::New( |
1405 "function f() {\n" | 1405 "function f() {\n" |
1406 " function h() {\n" | 1406 " function h() {\n" |
1407 " a = 0; // line 2\n" | 1407 " a = 0; // line 2\n" |
1408 " }\n" | 1408 " }\n" |
1409 " b = 1; // line 4\n" | 1409 " b = 1; // line 4\n" |
1410 " return h();\n" | 1410 " return h();\n" |
(...skipping 26 matching lines...) Expand all Loading... |
1437 | 1437 |
1438 // Compile the script again and get the function. | 1438 // Compile the script again and get the function. |
1439 v8::Script::Compile(script, &origin_1)->Run(); | 1439 v8::Script::Compile(script, &origin_1)->Run(); |
1440 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 1440 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); |
1441 | 1441 |
1442 // Call f and check that the script break point is active. | 1442 // Call f and check that the script break point is active. |
1443 break_point_hit_count = 0; | 1443 break_point_hit_count = 0; |
1444 f->Call(env->Global(), 0, NULL); | 1444 f->Call(env->Global(), 0, NULL); |
1445 CHECK_EQ(1, break_point_hit_count); | 1445 CHECK_EQ(1, break_point_hit_count); |
1446 | 1446 |
1447 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1447 v8::Debug::SetDebugEventListener(NULL); |
1448 } | 1448 } |
1449 | 1449 |
1450 | 1450 |
1451 // Test when several scripts has the same script data | 1451 // Test when several scripts has the same script data |
1452 TEST(ScriptBreakPointMultiple) { | 1452 TEST(ScriptBreakPointMultiple) { |
1453 break_point_hit_count = 0; | 1453 break_point_hit_count = 0; |
1454 v8::HandleScope scope; | 1454 v8::HandleScope scope; |
1455 DebugLocalContext env; | 1455 DebugLocalContext env; |
1456 env.ExposeDebug(); | 1456 env.ExposeDebug(); |
1457 | 1457 |
1458 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1458 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1459 v8::Undefined()); | 1459 v8::Undefined()); |
1460 | 1460 |
1461 v8::Local<v8::Function> f; | 1461 v8::Local<v8::Function> f; |
1462 v8::Local<v8::String> script_f = v8::String::New( | 1462 v8::Local<v8::String> script_f = v8::String::New( |
1463 "function f() {\n" | 1463 "function f() {\n" |
1464 " a = 0; // line 1\n" | 1464 " a = 0; // line 1\n" |
1465 "}"); | 1465 "}"); |
1466 | 1466 |
1467 v8::Local<v8::Function> g; | 1467 v8::Local<v8::Function> g; |
1468 v8::Local<v8::String> script_g = v8::String::New( | 1468 v8::Local<v8::String> script_g = v8::String::New( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 // Set script break point with the scripts loaded. | 1502 // Set script break point with the scripts loaded. |
1503 sbp = SetScriptBreakPointFromJS("test", 1, 0); | 1503 sbp = SetScriptBreakPointFromJS("test", 1, 0); |
1504 | 1504 |
1505 // Call f and g and check that the script break point is active. | 1505 // Call f and g and check that the script break point is active. |
1506 break_point_hit_count = 0; | 1506 break_point_hit_count = 0; |
1507 f->Call(env->Global(), 0, NULL); | 1507 f->Call(env->Global(), 0, NULL); |
1508 CHECK_EQ(1, break_point_hit_count); | 1508 CHECK_EQ(1, break_point_hit_count); |
1509 g->Call(env->Global(), 0, NULL); | 1509 g->Call(env->Global(), 0, NULL); |
1510 CHECK_EQ(2, break_point_hit_count); | 1510 CHECK_EQ(2, break_point_hit_count); |
1511 | 1511 |
1512 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1512 v8::Debug::SetDebugEventListener(NULL); |
1513 } | 1513 } |
1514 | 1514 |
1515 | 1515 |
1516 // Test the script origin which has both name and line offset. | 1516 // Test the script origin which has both name and line offset. |
1517 TEST(ScriptBreakPointLineOffset) { | 1517 TEST(ScriptBreakPointLineOffset) { |
1518 break_point_hit_count = 0; | 1518 break_point_hit_count = 0; |
1519 v8::HandleScope scope; | 1519 v8::HandleScope scope; |
1520 DebugLocalContext env; | 1520 DebugLocalContext env; |
1521 env.ExposeDebug(); | 1521 env.ExposeDebug(); |
1522 | 1522 |
1523 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1523 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1524 v8::Undefined()); | 1524 v8::Undefined()); |
1525 | 1525 |
1526 v8::Local<v8::Function> f; | 1526 v8::Local<v8::Function> f; |
1527 v8::Local<v8::String> script = v8::String::New( | 1527 v8::Local<v8::String> script = v8::String::New( |
1528 "function f() {\n" | 1528 "function f() {\n" |
1529 " a = 0; // line 8 as this script has line offset 7\n" | 1529 " a = 0; // line 8 as this script has line offset 7\n" |
1530 " b = 0; // line 9 as this script has line offset 7\n" | 1530 " b = 0; // line 9 as this script has line offset 7\n" |
1531 "}"); | 1531 "}"); |
1532 | 1532 |
1533 // Create script origin both name and line offset. | 1533 // Create script origin both name and line offset. |
(...skipping 23 matching lines...) Expand all Loading... |
1557 CHECK_EQ(0, break_point_hit_count); | 1557 CHECK_EQ(0, break_point_hit_count); |
1558 | 1558 |
1559 // Set a script break point with the script loaded. | 1559 // Set a script break point with the script loaded. |
1560 sbp1 = SetScriptBreakPointFromJS("test.html", 9, 0); | 1560 sbp1 = SetScriptBreakPointFromJS("test.html", 9, 0); |
1561 | 1561 |
1562 // Call f and check that the script break point is active. | 1562 // Call f and check that the script break point is active. |
1563 break_point_hit_count = 0; | 1563 break_point_hit_count = 0; |
1564 f->Call(env->Global(), 0, NULL); | 1564 f->Call(env->Global(), 0, NULL); |
1565 CHECK_EQ(1, break_point_hit_count); | 1565 CHECK_EQ(1, break_point_hit_count); |
1566 | 1566 |
1567 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1567 v8::Debug::SetDebugEventListener(NULL); |
1568 } | 1568 } |
1569 | 1569 |
1570 | 1570 |
1571 // Test script break points set on lines. | 1571 // Test script break points set on lines. |
1572 TEST(ScriptBreakPointLine) { | 1572 TEST(ScriptBreakPointLine) { |
1573 v8::HandleScope scope; | 1573 v8::HandleScope scope; |
1574 DebugLocalContext env; | 1574 DebugLocalContext env; |
1575 env.ExposeDebug(); | 1575 env.ExposeDebug(); |
1576 | 1576 |
1577 // Create a function for checking the function when hitting a break point. | 1577 // Create a function for checking the function when hitting a break point. |
1578 frame_function_name = CompileFunction(&env, | 1578 frame_function_name = CompileFunction(&env, |
1579 frame_function_name_source, | 1579 frame_function_name_source, |
1580 "frame_function_name"); | 1580 "frame_function_name"); |
1581 | 1581 |
1582 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1582 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1583 v8::Undefined()); | 1583 v8::Undefined()); |
1584 | 1584 |
1585 v8::Local<v8::Function> f; | 1585 v8::Local<v8::Function> f; |
1586 v8::Local<v8::Function> g; | 1586 v8::Local<v8::Function> g; |
1587 v8::Local<v8::String> script = v8::String::New( | 1587 v8::Local<v8::String> script = v8::String::New( |
1588 "a = 0 // line 0\n" | 1588 "a = 0 // line 0\n" |
1589 "function f() {\n" | 1589 "function f() {\n" |
1590 " a = 1; // line 2\n" | 1590 " a = 1; // line 2\n" |
1591 "}\n" | 1591 "}\n" |
1592 " a = 2; // line 4\n" | 1592 " a = 2; // line 4\n" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 | 1662 |
1663 // Clear the last break points, and reload the script which should not hit any | 1663 // Clear the last break points, and reload the script which should not hit any |
1664 // break points. | 1664 // break points. |
1665 ClearBreakPointFromJS(sbp1); | 1665 ClearBreakPointFromJS(sbp1); |
1666 ClearBreakPointFromJS(sbp5); | 1666 ClearBreakPointFromJS(sbp5); |
1667 ClearBreakPointFromJS(sbp6); | 1667 ClearBreakPointFromJS(sbp6); |
1668 break_point_hit_count = 0; | 1668 break_point_hit_count = 0; |
1669 v8::Script::Compile(script, &origin)->Run(); | 1669 v8::Script::Compile(script, &origin)->Run(); |
1670 CHECK_EQ(0, break_point_hit_count); | 1670 CHECK_EQ(0, break_point_hit_count); |
1671 | 1671 |
1672 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1672 v8::Debug::SetDebugEventListener(NULL); |
1673 } | 1673 } |
1674 | 1674 |
1675 | 1675 |
1676 // Test that it is possible to remove the last break point for a function | 1676 // Test that it is possible to remove the last break point for a function |
1677 // inside the break handling of that break point. | 1677 // inside the break handling of that break point. |
1678 TEST(RemoveBreakPointInBreak) { | 1678 TEST(RemoveBreakPointInBreak) { |
1679 v8::HandleScope scope; | 1679 v8::HandleScope scope; |
1680 DebugLocalContext env; | 1680 DebugLocalContext env; |
1681 | 1681 |
1682 v8::Local<v8::Function> foo = | 1682 v8::Local<v8::Function> foo = |
1683 CompileFunction(&env, "function foo(){a=1;}", "foo"); | 1683 CompileFunction(&env, "function foo(){a=1;}", "foo"); |
1684 debug_event_remove_break_point = SetBreakPoint(foo, 0); | 1684 debug_event_remove_break_point = SetBreakPoint(foo, 0); |
1685 | 1685 |
1686 // Register the debug event listener pasing the function | 1686 // Register the debug event listener pasing the function |
1687 v8::Debug::AddDebugEventListener(DebugEventRemoveBreakPoint, foo); | 1687 v8::Debug::SetDebugEventListener(DebugEventRemoveBreakPoint, foo); |
1688 | 1688 |
1689 break_point_hit_count = 0; | 1689 break_point_hit_count = 0; |
1690 foo->Call(env->Global(), 0, NULL); | 1690 foo->Call(env->Global(), 0, NULL); |
1691 CHECK_EQ(1, break_point_hit_count); | 1691 CHECK_EQ(1, break_point_hit_count); |
1692 | 1692 |
1693 break_point_hit_count = 0; | 1693 break_point_hit_count = 0; |
1694 foo->Call(env->Global(), 0, NULL); | 1694 foo->Call(env->Global(), 0, NULL); |
1695 CHECK_EQ(0, break_point_hit_count); | 1695 CHECK_EQ(0, break_point_hit_count); |
1696 | 1696 |
1697 v8::Debug::RemoveDebugEventListener(DebugEventRemoveBreakPoint); | 1697 v8::Debug::SetDebugEventListener(NULL); |
1698 } | 1698 } |
1699 | 1699 |
1700 | 1700 |
1701 // Test that the debugger statement causes a break. | 1701 // Test that the debugger statement causes a break. |
1702 TEST(DebuggerStatement) { | 1702 TEST(DebuggerStatement) { |
1703 break_point_hit_count = 0; | 1703 break_point_hit_count = 0; |
1704 v8::HandleScope scope; | 1704 v8::HandleScope scope; |
1705 DebugLocalContext env; | 1705 DebugLocalContext env; |
1706 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount, | 1706 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, |
1707 v8::Undefined()); | 1707 v8::Undefined()); |
1708 v8::Script::Compile(v8::String::New("function bar(){debugger}"))->Run(); | 1708 v8::Script::Compile(v8::String::New("function bar(){debugger}"))->Run(); |
1709 v8::Script::Compile(v8::String::New( | 1709 v8::Script::Compile(v8::String::New( |
1710 "function foo(){debugger;debugger;}"))->Run(); | 1710 "function foo(){debugger;debugger;}"))->Run(); |
1711 v8::Local<v8::Function> foo = | 1711 v8::Local<v8::Function> foo = |
1712 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); | 1712 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); |
1713 v8::Local<v8::Function> bar = | 1713 v8::Local<v8::Function> bar = |
1714 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("bar"))); | 1714 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("bar"))); |
1715 | 1715 |
1716 // Run function with debugger statement | 1716 // Run function with debugger statement |
1717 bar->Call(env->Global(), 0, NULL); | 1717 bar->Call(env->Global(), 0, NULL); |
1718 CHECK_EQ(1, break_point_hit_count); | 1718 CHECK_EQ(1, break_point_hit_count); |
1719 | 1719 |
1720 // Run function with two debugger statement | 1720 // Run function with two debugger statement |
1721 foo->Call(env->Global(), 0, NULL); | 1721 foo->Call(env->Global(), 0, NULL); |
1722 CHECK_EQ(3, break_point_hit_count); | 1722 CHECK_EQ(3, break_point_hit_count); |
1723 | 1723 |
1724 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1724 v8::Debug::SetDebugEventListener(NULL); |
1725 } | 1725 } |
1726 | 1726 |
1727 | 1727 |
1728 // Thest that the evaluation of expressions when a break point is hit generates | 1728 // Thest that the evaluation of expressions when a break point is hit generates |
1729 // the correct results. | 1729 // the correct results. |
1730 TEST(DebugEvaluate) { | 1730 TEST(DebugEvaluate) { |
1731 v8::HandleScope scope; | 1731 v8::HandleScope scope; |
1732 DebugLocalContext env; | 1732 DebugLocalContext env; |
1733 env.ExposeDebug(); | 1733 env.ExposeDebug(); |
1734 | 1734 |
1735 // Create a function for checking the evaluation when hitting a break point. | 1735 // Create a function for checking the evaluation when hitting a break point. |
1736 evaluate_check_function = CompileFunction(&env, | 1736 evaluate_check_function = CompileFunction(&env, |
1737 evaluate_check_source, | 1737 evaluate_check_source, |
1738 "evaluate_check"); | 1738 "evaluate_check"); |
1739 // Register the debug event listener | 1739 // Register the debug event listener |
1740 v8::Debug::AddDebugEventListener(DebugEventEvaluate); | 1740 v8::Debug::SetDebugEventListener(DebugEventEvaluate); |
1741 | 1741 |
1742 // Different expected vaules of x and a when in a break point (u = undefined, | 1742 // Different expected vaules of x and a when in a break point (u = undefined, |
1743 // d = Hello, world!). | 1743 // d = Hello, world!). |
1744 struct EvaluateCheck checks_uu[] = { | 1744 struct EvaluateCheck checks_uu[] = { |
1745 {"x", v8::Undefined()}, | 1745 {"x", v8::Undefined()}, |
1746 {"a", v8::Undefined()}, | 1746 {"a", v8::Undefined()}, |
1747 {NULL, v8::Handle<v8::Value>()} | 1747 {NULL, v8::Handle<v8::Value>()} |
1748 }; | 1748 }; |
1749 struct EvaluateCheck checks_hu[] = { | 1749 struct EvaluateCheck checks_hu[] = { |
1750 {"x", v8::String::New("Hello, world!")}, | 1750 {"x", v8::String::New("Hello, world!")}, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 | 1828 |
1829 // Call bar setting breakpoint after a=x in barbar and parameter | 1829 // Call bar setting breakpoint after a=x in barbar and parameter |
1830 // "Hello, world!". | 1830 // "Hello, world!". |
1831 checks = checks_hh; | 1831 checks = checks_hh; |
1832 v8::Handle<v8::Value> argv_bar_3[2] = { | 1832 v8::Handle<v8::Value> argv_bar_3[2] = { |
1833 v8::String::New("Hello, world!"), | 1833 v8::String::New("Hello, world!"), |
1834 v8::Number::New(barbar_break_position + 1) | 1834 v8::Number::New(barbar_break_position + 1) |
1835 }; | 1835 }; |
1836 bar->Call(env->Global(), 2, argv_bar_3); | 1836 bar->Call(env->Global(), 2, argv_bar_3); |
1837 | 1837 |
1838 v8::Debug::RemoveDebugEventListener(DebugEventEvaluate); | 1838 v8::Debug::SetDebugEventListener(NULL); |
1839 } | 1839 } |
1840 | 1840 |
1841 | 1841 |
1842 // Simple test of the stepping mechanism using only store ICs. | 1842 // Simple test of the stepping mechanism using only store ICs. |
1843 TEST(DebugStepLinear) { | 1843 TEST(DebugStepLinear) { |
1844 v8::HandleScope scope; | 1844 v8::HandleScope scope; |
1845 DebugLocalContext env; | 1845 DebugLocalContext env; |
1846 | 1846 |
1847 // Create a function for testing stepping. | 1847 // Create a function for testing stepping. |
1848 v8::Local<v8::Function> foo = CompileFunction(&env, | 1848 v8::Local<v8::Function> foo = CompileFunction(&env, |
1849 "function foo(){a=1;b=1;c=1;}", | 1849 "function foo(){a=1;b=1;c=1;}", |
1850 "foo"); | 1850 "foo"); |
1851 SetBreakPoint(foo, 3); | 1851 SetBreakPoint(foo, 3); |
1852 | 1852 |
1853 // Register a debug event listener which steps and counts. | 1853 // Register a debug event listener which steps and counts. |
1854 v8::Debug::AddDebugEventListener(DebugEventStep); | 1854 v8::Debug::SetDebugEventListener(DebugEventStep); |
1855 | 1855 |
1856 step_action = StepIn; | 1856 step_action = StepIn; |
1857 break_point_hit_count = 0; | 1857 break_point_hit_count = 0; |
1858 foo->Call(env->Global(), 0, NULL); | 1858 foo->Call(env->Global(), 0, NULL); |
1859 | 1859 |
1860 // With stepping all break locations are hit. | 1860 // With stepping all break locations are hit. |
1861 CHECK_EQ(4, break_point_hit_count); | 1861 CHECK_EQ(4, break_point_hit_count); |
1862 | 1862 |
1863 v8::Debug::RemoveDebugEventListener(DebugEventStep); | 1863 v8::Debug::SetDebugEventListener(NULL); |
1864 | 1864 |
1865 // Register a debug event listener which just counts. | 1865 // Register a debug event listener which just counts. |
1866 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount); | 1866 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount); |
1867 | 1867 |
1868 break_point_hit_count = 0; | 1868 break_point_hit_count = 0; |
1869 foo->Call(env->Global(), 0, NULL); | 1869 foo->Call(env->Global(), 0, NULL); |
1870 | 1870 |
1871 // Without stepping only active break points are hit. | 1871 // Without stepping only active break points are hit. |
1872 CHECK_EQ(1, break_point_hit_count); | 1872 CHECK_EQ(1, break_point_hit_count); |
1873 | 1873 |
1874 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1874 v8::Debug::SetDebugEventListener(NULL); |
1875 } | 1875 } |
1876 | 1876 |
1877 | 1877 |
1878 // Test the stepping mechanism with different ICs. | 1878 // Test the stepping mechanism with different ICs. |
1879 TEST(DebugStepLinearMixedICs) { | 1879 TEST(DebugStepLinearMixedICs) { |
1880 v8::HandleScope scope; | 1880 v8::HandleScope scope; |
1881 DebugLocalContext env; | 1881 DebugLocalContext env; |
1882 | 1882 |
1883 // Create a function for testing stepping. | 1883 // Create a function for testing stepping. |
1884 v8::Local<v8::Function> foo = CompileFunction(&env, | 1884 v8::Local<v8::Function> foo = CompileFunction(&env, |
1885 "function bar() {};" | 1885 "function bar() {};" |
1886 "function foo() {" | 1886 "function foo() {" |
1887 " var x;" | 1887 " var x;" |
1888 " var index='name';" | 1888 " var index='name';" |
1889 " var y = {};" | 1889 " var y = {};" |
1890 " a=1;b=2;x=a;y[index]=3;x=y[index];bar();}", "foo"); | 1890 " a=1;b=2;x=a;y[index]=3;x=y[index];bar();}", "foo"); |
1891 SetBreakPoint(foo, 0); | 1891 SetBreakPoint(foo, 0); |
1892 | 1892 |
1893 // Register a debug event listener which steps and counts. | 1893 // Register a debug event listener which steps and counts. |
1894 v8::Debug::AddDebugEventListener(DebugEventStep); | 1894 v8::Debug::SetDebugEventListener(DebugEventStep); |
1895 | 1895 |
1896 step_action = StepIn; | 1896 step_action = StepIn; |
1897 break_point_hit_count = 0; | 1897 break_point_hit_count = 0; |
1898 foo->Call(env->Global(), 0, NULL); | 1898 foo->Call(env->Global(), 0, NULL); |
1899 | 1899 |
1900 // With stepping all break locations are hit. For ARM the keyed load/store | 1900 // With stepping all break locations are hit. For ARM the keyed load/store |
1901 // is not hit as they are not implemented as ICs. | 1901 // is not hit as they are not implemented as ICs. |
1902 #if defined (__arm__) || defined(__thumb__) | 1902 #if defined (__arm__) || defined(__thumb__) |
1903 CHECK_EQ(6, break_point_hit_count); | 1903 CHECK_EQ(6, break_point_hit_count); |
1904 #else | 1904 #else |
1905 CHECK_EQ(8, break_point_hit_count); | 1905 CHECK_EQ(8, break_point_hit_count); |
1906 #endif | 1906 #endif |
1907 | 1907 |
1908 v8::Debug::RemoveDebugEventListener(DebugEventStep); | 1908 v8::Debug::SetDebugEventListener(NULL); |
1909 | 1909 |
1910 // Register a debug event listener which just counts. | 1910 // Register a debug event listener which just counts. |
1911 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount); | 1911 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount); |
1912 | 1912 |
1913 break_point_hit_count = 0; | 1913 break_point_hit_count = 0; |
1914 foo->Call(env->Global(), 0, NULL); | 1914 foo->Call(env->Global(), 0, NULL); |
1915 | 1915 |
1916 // Without stepping only active break points are hit. | 1916 // Without stepping only active break points are hit. |
1917 CHECK_EQ(1, break_point_hit_count); | 1917 CHECK_EQ(1, break_point_hit_count); |
1918 | 1918 |
1919 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 1919 v8::Debug::SetDebugEventListener(NULL); |
1920 } | 1920 } |
1921 | 1921 |
1922 | 1922 |
1923 TEST(DebugStepIf) { | 1923 TEST(DebugStepIf) { |
1924 v8::HandleScope scope; | 1924 v8::HandleScope scope; |
1925 DebugLocalContext env; | 1925 DebugLocalContext env; |
1926 | 1926 |
1927 // Register a debug event listener which steps and counts. | 1927 // Register a debug event listener which steps and counts. |
1928 v8::Debug::AddDebugEventListener(DebugEventStep); | 1928 v8::Debug::SetDebugEventListener(DebugEventStep); |
1929 | 1929 |
1930 // Create a function for testing stepping. | 1930 // Create a function for testing stepping. |
1931 const int argc = 1; | 1931 const int argc = 1; |
1932 const char* src = "function foo(x) { " | 1932 const char* src = "function foo(x) { " |
1933 " a = 1;" | 1933 " a = 1;" |
1934 " if (x) {" | 1934 " if (x) {" |
1935 " b = 1;" | 1935 " b = 1;" |
1936 " } else {" | 1936 " } else {" |
1937 " c = 1;" | 1937 " c = 1;" |
1938 " d = 1;" | 1938 " d = 1;" |
(...skipping 10 matching lines...) Expand all Loading... |
1949 CHECK_EQ(3, break_point_hit_count); | 1949 CHECK_EQ(3, break_point_hit_count); |
1950 | 1950 |
1951 // Stepping through the false part. | 1951 // Stepping through the false part. |
1952 step_action = StepIn; | 1952 step_action = StepIn; |
1953 break_point_hit_count = 0; | 1953 break_point_hit_count = 0; |
1954 v8::Handle<v8::Value> argv_false[argc] = { v8::False() }; | 1954 v8::Handle<v8::Value> argv_false[argc] = { v8::False() }; |
1955 foo->Call(env->Global(), argc, argv_false); | 1955 foo->Call(env->Global(), argc, argv_false); |
1956 CHECK_EQ(4, break_point_hit_count); | 1956 CHECK_EQ(4, break_point_hit_count); |
1957 | 1957 |
1958 // Get rid of the debug event listener. | 1958 // Get rid of the debug event listener. |
1959 v8::Debug::RemoveDebugEventListener(DebugEventStep); | 1959 v8::Debug::SetDebugEventListener(NULL); |
1960 } | 1960 } |
1961 | 1961 |
1962 | 1962 |
1963 TEST(DebugStepSwitch) { | 1963 TEST(DebugStepSwitch) { |
1964 v8::HandleScope scope; | 1964 v8::HandleScope scope; |
1965 DebugLocalContext env; | 1965 DebugLocalContext env; |
1966 | 1966 |
1967 // Register a debug event listener which steps and counts. | 1967 // Register a debug event listener which steps and counts. |
1968 v8::Debug::AddDebugEventListener(DebugEventStep); | 1968 v8::Debug::SetDebugEventListener(DebugEventStep); |
1969 | 1969 |
1970 // Create a function for testing stepping. | 1970 // Create a function for testing stepping. |
1971 const int argc = 1; | 1971 const int argc = 1; |
1972 const char* src = "function foo(x) { " | 1972 const char* src = "function foo(x) { " |
1973 " a = 1;" | 1973 " a = 1;" |
1974 " switch (x) {" | 1974 " switch (x) {" |
1975 " case 1:" | 1975 " case 1:" |
1976 " b = 1;" | 1976 " b = 1;" |
1977 " case 2:" | 1977 " case 2:" |
1978 " c = 1;" | 1978 " c = 1;" |
(...skipping 22 matching lines...) Expand all Loading... |
2001 CHECK_EQ(3, break_point_hit_count); | 2001 CHECK_EQ(3, break_point_hit_count); |
2002 | 2002 |
2003 // Last case. | 2003 // Last case. |
2004 step_action = StepIn; | 2004 step_action = StepIn; |
2005 break_point_hit_count = 0; | 2005 break_point_hit_count = 0; |
2006 v8::Handle<v8::Value> argv_3[argc] = { v8::Number::New(3) }; | 2006 v8::Handle<v8::Value> argv_3[argc] = { v8::Number::New(3) }; |
2007 foo->Call(env->Global(), argc, argv_3); | 2007 foo->Call(env->Global(), argc, argv_3); |
2008 CHECK_EQ(4, break_point_hit_count); | 2008 CHECK_EQ(4, break_point_hit_count); |
2009 | 2009 |
2010 // Get rid of the debug event listener. | 2010 // Get rid of the debug event listener. |
2011 v8::Debug::RemoveDebugEventListener(DebugEventStep); | 2011 v8::Debug::SetDebugEventListener(NULL); |
2012 } | 2012 } |
2013 | 2013 |
2014 | 2014 |
2015 TEST(DebugStepFor) { | 2015 TEST(DebugStepFor) { |
2016 v8::HandleScope scope; | 2016 v8::HandleScope scope; |
2017 DebugLocalContext env; | 2017 DebugLocalContext env; |
2018 | 2018 |
2019 // Register a debug event listener which steps and counts. | 2019 // Register a debug event listener which steps and counts. |
2020 v8::Debug::AddDebugEventListener(DebugEventStep); | 2020 v8::Debug::SetDebugEventListener(DebugEventStep); |
2021 | 2021 |
2022 // Create a function for testing stepping. | 2022 // Create a function for testing stepping. |
2023 const int argc = 1; | 2023 const int argc = 1; |
2024 const char* src = "function foo(x) { " | 2024 const char* src = "function foo(x) { " |
2025 " a = 1;" | 2025 " a = 1;" |
2026 " for (i = 0; i < x; i++) {" | 2026 " for (i = 0; i < x; i++) {" |
2027 " b = 1;" | 2027 " b = 1;" |
2028 " }" | 2028 " }" |
2029 "}"; | 2029 "}"; |
2030 v8::Local<v8::Function> foo = CompileFunction(&env, src, "foo"); | 2030 v8::Local<v8::Function> foo = CompileFunction(&env, src, "foo"); |
2031 SetBreakPoint(foo, 8); // "a = 1;" | 2031 SetBreakPoint(foo, 8); // "a = 1;" |
2032 | 2032 |
2033 // Looping 10 times. | 2033 // Looping 10 times. |
2034 step_action = StepIn; | 2034 step_action = StepIn; |
2035 break_point_hit_count = 0; | 2035 break_point_hit_count = 0; |
2036 v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) }; | 2036 v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) }; |
2037 foo->Call(env->Global(), argc, argv_10); | 2037 foo->Call(env->Global(), argc, argv_10); |
2038 CHECK_EQ(23, break_point_hit_count); | 2038 CHECK_EQ(23, break_point_hit_count); |
2039 | 2039 |
2040 // Looping 100 times. | 2040 // Looping 100 times. |
2041 step_action = StepIn; | 2041 step_action = StepIn; |
2042 break_point_hit_count = 0; | 2042 break_point_hit_count = 0; |
2043 v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) }; | 2043 v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) }; |
2044 foo->Call(env->Global(), argc, argv_100); | 2044 foo->Call(env->Global(), argc, argv_100); |
2045 CHECK_EQ(203, break_point_hit_count); | 2045 CHECK_EQ(203, break_point_hit_count); |
2046 | 2046 |
2047 // Get rid of the debug event listener. | 2047 // Get rid of the debug event listener. |
2048 v8::Debug::RemoveDebugEventListener(DebugEventStep); | 2048 v8::Debug::SetDebugEventListener(NULL); |
2049 } | 2049 } |
2050 | 2050 |
2051 | 2051 |
2052 TEST(StepInOutSimple) { | 2052 TEST(StepInOutSimple) { |
2053 v8::HandleScope scope; | 2053 v8::HandleScope scope; |
2054 DebugLocalContext env; | 2054 DebugLocalContext env; |
2055 | 2055 |
2056 // Create a function for checking the function when hitting a break point. | 2056 // Create a function for checking the function when hitting a break point. |
2057 frame_function_name = CompileFunction(&env, | 2057 frame_function_name = CompileFunction(&env, |
2058 frame_function_name_source, | 2058 frame_function_name_source, |
2059 "frame_function_name"); | 2059 "frame_function_name"); |
2060 | 2060 |
2061 // Register a debug event listener which steps and counts. | 2061 // Register a debug event listener which steps and counts. |
2062 v8::Debug::AddDebugEventListener(DebugEventStepSequence); | 2062 v8::Debug::SetDebugEventListener(DebugEventStepSequence); |
2063 | 2063 |
2064 // Create functions for testing stepping. | 2064 // Create functions for testing stepping. |
2065 const char* src = "function a() {b();c();}; " | 2065 const char* src = "function a() {b();c();}; " |
2066 "function b() {c();}; " | 2066 "function b() {c();}; " |
2067 "function c() {}; "; | 2067 "function c() {}; "; |
2068 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); | 2068 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); |
2069 SetBreakPoint(a, 0); | 2069 SetBreakPoint(a, 0); |
2070 | 2070 |
2071 // Step through invocation of a with step in. | 2071 // Step through invocation of a with step in. |
2072 step_action = StepIn; | 2072 step_action = StepIn; |
(...skipping 10 matching lines...) Expand all Loading... |
2083 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2083 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); |
2084 | 2084 |
2085 // Step through invocation of a with step out. | 2085 // Step through invocation of a with step out. |
2086 step_action = StepOut; | 2086 step_action = StepOut; |
2087 break_point_hit_count = 0; | 2087 break_point_hit_count = 0; |
2088 expected_step_sequence = "a"; | 2088 expected_step_sequence = "a"; |
2089 a->Call(env->Global(), 0, NULL); | 2089 a->Call(env->Global(), 0, NULL); |
2090 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2090 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); |
2091 | 2091 |
2092 // Get rid of the debug event listener. | 2092 // Get rid of the debug event listener. |
2093 v8::Debug::RemoveDebugEventListener(DebugEventStepSequence); | 2093 v8::Debug::SetDebugEventListener(NULL); |
2094 } | 2094 } |
2095 | 2095 |
2096 | 2096 |
2097 TEST(StepInOutTree) { | 2097 TEST(StepInOutTree) { |
2098 v8::HandleScope scope; | 2098 v8::HandleScope scope; |
2099 DebugLocalContext env; | 2099 DebugLocalContext env; |
2100 | 2100 |
2101 // Create a function for checking the function when hitting a break point. | 2101 // Create a function for checking the function when hitting a break point. |
2102 frame_function_name = CompileFunction(&env, | 2102 frame_function_name = CompileFunction(&env, |
2103 frame_function_name_source, | 2103 frame_function_name_source, |
2104 "frame_function_name"); | 2104 "frame_function_name"); |
2105 | 2105 |
2106 // Register a debug event listener which steps and counts. | 2106 // Register a debug event listener which steps and counts. |
2107 v8::Debug::AddDebugEventListener(DebugEventStepSequence); | 2107 v8::Debug::SetDebugEventListener(DebugEventStepSequence); |
2108 | 2108 |
2109 // Create functions for testing stepping. | 2109 // Create functions for testing stepping. |
2110 const char* src = "function a() {b(c(d()),d());c(d());d()}; " | 2110 const char* src = "function a() {b(c(d()),d());c(d());d()}; " |
2111 "function b(x,y) {c();}; " | 2111 "function b(x,y) {c();}; " |
2112 "function c(x) {}; " | 2112 "function c(x) {}; " |
2113 "function d() {}; "; | 2113 "function d() {}; "; |
2114 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); | 2114 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); |
2115 SetBreakPoint(a, 0); | 2115 SetBreakPoint(a, 0); |
2116 | 2116 |
2117 // Step through invocation of a with step in. | 2117 // Step through invocation of a with step in. |
(...skipping 11 matching lines...) Expand all Loading... |
2129 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2129 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); |
2130 | 2130 |
2131 // Step through invocation of a with step out. | 2131 // Step through invocation of a with step out. |
2132 step_action = StepOut; | 2132 step_action = StepOut; |
2133 break_point_hit_count = 0; | 2133 break_point_hit_count = 0; |
2134 expected_step_sequence = "a"; | 2134 expected_step_sequence = "a"; |
2135 a->Call(env->Global(), 0, NULL); | 2135 a->Call(env->Global(), 0, NULL); |
2136 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2136 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); |
2137 | 2137 |
2138 // Get rid of the debug event listener. | 2138 // Get rid of the debug event listener. |
2139 v8::Debug::RemoveDebugEventListener(DebugEventStepSequence); | 2139 v8::Debug::SetDebugEventListener(NULL); |
2140 } | 2140 } |
2141 | 2141 |
2142 | 2142 |
2143 TEST(StepInOutBranch) { | 2143 TEST(StepInOutBranch) { |
2144 v8::HandleScope scope; | 2144 v8::HandleScope scope; |
2145 DebugLocalContext env; | 2145 DebugLocalContext env; |
2146 | 2146 |
2147 // Create a function for checking the function when hitting a break point. | 2147 // Create a function for checking the function when hitting a break point. |
2148 frame_function_name = CompileFunction(&env, | 2148 frame_function_name = CompileFunction(&env, |
2149 frame_function_name_source, | 2149 frame_function_name_source, |
2150 "frame_function_name"); | 2150 "frame_function_name"); |
2151 | 2151 |
2152 // Register a debug event listener which steps and counts. | 2152 // Register a debug event listener which steps and counts. |
2153 v8::Debug::AddDebugEventListener(DebugEventStepSequence); | 2153 v8::Debug::SetDebugEventListener(DebugEventStepSequence); |
2154 | 2154 |
2155 // Create functions for testing stepping. | 2155 // Create functions for testing stepping. |
2156 const char* src = "function a() {b(false);c();}; " | 2156 const char* src = "function a() {b(false);c();}; " |
2157 "function b(x) {if(x){c();};}; " | 2157 "function b(x) {if(x){c();};}; " |
2158 "function c() {}; "; | 2158 "function c() {}; "; |
2159 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); | 2159 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); |
2160 SetBreakPoint(a, 0); | 2160 SetBreakPoint(a, 0); |
2161 | 2161 |
2162 // Step through invocation of a. | 2162 // Step through invocation of a. |
2163 step_action = StepIn; | 2163 step_action = StepIn; |
2164 break_point_hit_count = 0; | 2164 break_point_hit_count = 0; |
2165 expected_step_sequence = "abaca"; | 2165 expected_step_sequence = "abaca"; |
2166 a->Call(env->Global(), 0, NULL); | 2166 a->Call(env->Global(), 0, NULL); |
2167 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2167 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); |
2168 | 2168 |
2169 // Get rid of the debug event listener. | 2169 // Get rid of the debug event listener. |
2170 v8::Debug::RemoveDebugEventListener(DebugEventStepSequence); | 2170 v8::Debug::SetDebugEventListener(NULL); |
2171 } | 2171 } |
2172 | 2172 |
2173 | 2173 |
2174 // Test that step in does not step into native functions. | 2174 // Test that step in does not step into native functions. |
2175 TEST(DebugStepNatives) { | 2175 TEST(DebugStepNatives) { |
2176 v8::HandleScope scope; | 2176 v8::HandleScope scope; |
2177 DebugLocalContext env; | 2177 DebugLocalContext env; |
2178 | 2178 |
2179 // Create a function for testing stepping. | 2179 // Create a function for testing stepping. |
2180 v8::Local<v8::Function> foo = CompileFunction( | 2180 v8::Local<v8::Function> foo = CompileFunction( |
2181 &env, | 2181 &env, |
2182 "function foo(){debugger;Math.sin(1);}", | 2182 "function foo(){debugger;Math.sin(1);}", |
2183 "foo"); | 2183 "foo"); |
2184 | 2184 |
2185 // Register a debug event listener which steps and counts. | 2185 // Register a debug event listener which steps and counts. |
2186 v8::Debug::AddDebugEventListener(DebugEventStep); | 2186 v8::Debug::SetDebugEventListener(DebugEventStep); |
2187 | 2187 |
2188 step_action = StepIn; | 2188 step_action = StepIn; |
2189 break_point_hit_count = 0; | 2189 break_point_hit_count = 0; |
2190 foo->Call(env->Global(), 0, NULL); | 2190 foo->Call(env->Global(), 0, NULL); |
2191 | 2191 |
2192 // With stepping all break locations are hit. | 2192 // With stepping all break locations are hit. |
2193 CHECK_EQ(3, break_point_hit_count); | 2193 CHECK_EQ(3, break_point_hit_count); |
2194 | 2194 |
2195 v8::Debug::RemoveDebugEventListener(DebugEventStep); | 2195 v8::Debug::SetDebugEventListener(NULL); |
2196 | 2196 |
2197 // Register a debug event listener which just counts. | 2197 // Register a debug event listener which just counts. |
2198 v8::Debug::AddDebugEventListener(DebugEventBreakPointHitCount); | 2198 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount); |
2199 | 2199 |
2200 break_point_hit_count = 0; | 2200 break_point_hit_count = 0; |
2201 foo->Call(env->Global(), 0, NULL); | 2201 foo->Call(env->Global(), 0, NULL); |
2202 | 2202 |
2203 // Without stepping only active break points are hit. | 2203 // Without stepping only active break points are hit. |
2204 CHECK_EQ(1, break_point_hit_count); | 2204 CHECK_EQ(1, break_point_hit_count); |
2205 | 2205 |
2206 v8::Debug::RemoveDebugEventListener(DebugEventBreakPointHitCount); | 2206 v8::Debug::SetDebugEventListener(NULL); |
2207 } | 2207 } |
2208 | 2208 |
2209 | 2209 |
2210 // Test break on exceptions. For each exception break combination the number | 2210 // Test break on exceptions. For each exception break combination the number |
2211 // of debug event exception callbacks and message callbacks are collected. The | 2211 // of debug event exception callbacks and message callbacks are collected. The |
2212 // number of debug event exception callbacks are used to check that the | 2212 // number of debug event exception callbacks are used to check that the |
2213 // debugger is called correctly and the number of message callbacks is used to | 2213 // debugger is called correctly and the number of message callbacks is used to |
2214 // check that uncaught exceptions are still returned even if there is a break | 2214 // check that uncaught exceptions are still returned even if there is a break |
2215 // for them. | 2215 // for them. |
2216 TEST(BreakOnException) { | 2216 TEST(BreakOnException) { |
2217 v8::HandleScope scope; | 2217 v8::HandleScope scope; |
2218 DebugLocalContext env; | 2218 DebugLocalContext env; |
2219 env.ExposeDebug(); | 2219 env.ExposeDebug(); |
2220 | 2220 |
2221 v8::internal::Top::TraceException(false); | 2221 v8::internal::Top::TraceException(false); |
2222 | 2222 |
2223 // Create functions for testing break on exception. | 2223 // Create functions for testing break on exception. |
2224 v8::Local<v8::Function> throws = | 2224 v8::Local<v8::Function> throws = |
2225 CompileFunction(&env, "function throws(){throw 1;}", "throws"); | 2225 CompileFunction(&env, "function throws(){throw 1;}", "throws"); |
2226 v8::Local<v8::Function> caught = | 2226 v8::Local<v8::Function> caught = |
2227 CompileFunction(&env, | 2227 CompileFunction(&env, |
2228 "function caught(){try {throws();} catch(e) {};}", | 2228 "function caught(){try {throws();} catch(e) {};}", |
2229 "caught"); | 2229 "caught"); |
2230 v8::Local<v8::Function> notCaught = | 2230 v8::Local<v8::Function> notCaught = |
2231 CompileFunction(&env, "function notCaught(){throws();}", "notCaught"); | 2231 CompileFunction(&env, "function notCaught(){throws();}", "notCaught"); |
2232 | 2232 |
2233 v8::V8::AddMessageListener(MessageCallbackCount); | 2233 v8::V8::AddMessageListener(MessageCallbackCount); |
2234 v8::Debug::AddDebugEventListener(DebugEventCounter); | 2234 v8::Debug::SetDebugEventListener(DebugEventCounter); |
2235 | 2235 |
2236 // Initial state should be break on uncaught exception. | 2236 // Initial state should be break on uncaught exception. |
2237 DebugEventCounterClear(); | 2237 DebugEventCounterClear(); |
2238 MessageCallbackCountClear(); | 2238 MessageCallbackCountClear(); |
2239 caught->Call(env->Global(), 0, NULL); | 2239 caught->Call(env->Global(), 0, NULL); |
2240 CHECK_EQ(0, exception_hit_count); | 2240 CHECK_EQ(0, exception_hit_count); |
2241 CHECK_EQ(0, uncaught_exception_hit_count); | 2241 CHECK_EQ(0, uncaught_exception_hit_count); |
2242 CHECK_EQ(0, message_callback_count); | 2242 CHECK_EQ(0, message_callback_count); |
2243 notCaught->Call(env->Global(), 0, NULL); | 2243 notCaught->Call(env->Global(), 0, NULL); |
2244 CHECK_EQ(1, exception_hit_count); | 2244 CHECK_EQ(1, exception_hit_count); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 ChangeBreakOnExceptionFromJS(true, false); | 2342 ChangeBreakOnExceptionFromJS(true, false); |
2343 caught->Call(env->Global(), 0, NULL); | 2343 caught->Call(env->Global(), 0, NULL); |
2344 CHECK_EQ(1, exception_hit_count); | 2344 CHECK_EQ(1, exception_hit_count); |
2345 CHECK_EQ(0, uncaught_exception_hit_count); | 2345 CHECK_EQ(0, uncaught_exception_hit_count); |
2346 CHECK_EQ(0, message_callback_count); | 2346 CHECK_EQ(0, message_callback_count); |
2347 notCaught->Call(env->Global(), 0, NULL); | 2347 notCaught->Call(env->Global(), 0, NULL); |
2348 CHECK_EQ(2, exception_hit_count); | 2348 CHECK_EQ(2, exception_hit_count); |
2349 CHECK_EQ(1, uncaught_exception_hit_count); | 2349 CHECK_EQ(1, uncaught_exception_hit_count); |
2350 CHECK_EQ(1, message_callback_count); | 2350 CHECK_EQ(1, message_callback_count); |
2351 | 2351 |
2352 v8::Debug::RemoveDebugEventListener(DebugEventCounter); | 2352 v8::Debug::SetDebugEventListener(NULL); |
2353 v8::V8::RemoveMessageListeners(MessageCallbackCount); | 2353 v8::V8::RemoveMessageListeners(MessageCallbackCount); |
2354 } | 2354 } |
2355 | 2355 |
2356 | 2356 |
2357 // Test break on exception from compiler errors. When compiling using | 2357 // Test break on exception from compiler errors. When compiling using |
2358 // v8::Script::Compile there is no JavaScript stack whereas when compiling using | 2358 // v8::Script::Compile there is no JavaScript stack whereas when compiling using |
2359 // eval there are JavaScript frames. | 2359 // eval there are JavaScript frames. |
2360 TEST(BreakOnCompileException) { | 2360 TEST(BreakOnCompileException) { |
2361 v8::HandleScope scope; | 2361 v8::HandleScope scope; |
2362 DebugLocalContext env; | 2362 DebugLocalContext env; |
2363 | 2363 |
2364 v8::internal::Top::TraceException(false); | 2364 v8::internal::Top::TraceException(false); |
2365 | 2365 |
2366 // Create a function for checking the function when hitting a break point. | 2366 // Create a function for checking the function when hitting a break point. |
2367 frame_count = CompileFunction(&env, frame_count_source, "frame_count"); | 2367 frame_count = CompileFunction(&env, frame_count_source, "frame_count"); |
2368 | 2368 |
2369 v8::V8::AddMessageListener(MessageCallbackCount); | 2369 v8::V8::AddMessageListener(MessageCallbackCount); |
2370 v8::Debug::AddDebugEventListener(DebugEventCounter); | 2370 v8::Debug::SetDebugEventListener(DebugEventCounter); |
2371 | 2371 |
2372 DebugEventCounterClear(); | 2372 DebugEventCounterClear(); |
2373 MessageCallbackCountClear(); | 2373 MessageCallbackCountClear(); |
2374 | 2374 |
2375 // Check initial state. | 2375 // Check initial state. |
2376 CHECK_EQ(0, exception_hit_count); | 2376 CHECK_EQ(0, exception_hit_count); |
2377 CHECK_EQ(0, uncaught_exception_hit_count); | 2377 CHECK_EQ(0, uncaught_exception_hit_count); |
2378 CHECK_EQ(0, message_callback_count); | 2378 CHECK_EQ(0, message_callback_count); |
2379 CHECK_EQ(-1, last_js_stack_height); | 2379 CHECK_EQ(-1, last_js_stack_height); |
2380 | 2380 |
(...skipping 30 matching lines...) Expand all Loading... |
2411 TEST(StepWithException) { | 2411 TEST(StepWithException) { |
2412 v8::HandleScope scope; | 2412 v8::HandleScope scope; |
2413 DebugLocalContext env; | 2413 DebugLocalContext env; |
2414 | 2414 |
2415 // Create a function for checking the function when hitting a break point. | 2415 // Create a function for checking the function when hitting a break point. |
2416 frame_function_name = CompileFunction(&env, | 2416 frame_function_name = CompileFunction(&env, |
2417 frame_function_name_source, | 2417 frame_function_name_source, |
2418 "frame_function_name"); | 2418 "frame_function_name"); |
2419 | 2419 |
2420 // Register a debug event listener which steps and counts. | 2420 // Register a debug event listener which steps and counts. |
2421 v8::Debug::AddDebugEventListener(DebugEventStepSequence); | 2421 v8::Debug::SetDebugEventListener(DebugEventStepSequence); |
2422 | 2422 |
2423 // Create functions for testing stepping. | 2423 // Create functions for testing stepping. |
2424 const char* src = "function a() { n(); }; " | 2424 const char* src = "function a() { n(); }; " |
2425 "function b() { c(); }; " | 2425 "function b() { c(); }; " |
2426 "function c() { n(); }; " | 2426 "function c() { n(); }; " |
2427 "function d() { x = 1; try { e(); } catch(x) { x = 2; } }; " | 2427 "function d() { x = 1; try { e(); } catch(x) { x = 2; } }; " |
2428 "function e() { n(); }; " | 2428 "function e() { n(); }; " |
2429 "function f() { x = 1; try { g(); } catch(x) { x = 2; } }; " | 2429 "function f() { x = 1; try { g(); } catch(x) { x = 2; } }; " |
2430 "function g() { h(); }; " | 2430 "function g() { h(); }; " |
2431 "function h() { x = 1; throw 1; }; "; | 2431 "function h() { x = 1; throw 1; }; "; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2478 | 2478 |
2479 // Step through invocation of f + g + h now with break on caught exceptions. | 2479 // Step through invocation of f + g + h now with break on caught exceptions. |
2480 ChangeBreakOnException(true, true); | 2480 ChangeBreakOnException(true, true); |
2481 step_action = StepIn; | 2481 step_action = StepIn; |
2482 break_point_hit_count = 0; | 2482 break_point_hit_count = 0; |
2483 expected_step_sequence = "ffghhf"; | 2483 expected_step_sequence = "ffghhf"; |
2484 f->Call(env->Global(), 0, NULL); | 2484 f->Call(env->Global(), 0, NULL); |
2485 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2485 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); |
2486 | 2486 |
2487 // Get rid of the debug event listener. | 2487 // Get rid of the debug event listener. |
2488 v8::Debug::RemoveDebugEventListener(DebugEventStepSequence); | 2488 v8::Debug::SetDebugEventListener(NULL); |
2489 } | 2489 } |
2490 | 2490 |
2491 | 2491 |
2492 TEST(DebugBreak) { | 2492 TEST(DebugBreak) { |
2493 v8::HandleScope scope; | 2493 v8::HandleScope scope; |
2494 DebugLocalContext env; | 2494 DebugLocalContext env; |
2495 | 2495 |
2496 // This test should be run with option --verify-heap. This is an ASSERT and | 2496 // This test should be run with option --verify-heap. This is an ASSERT and |
2497 // not a CHECK as --verify-heap is only available in debug mode. | 2497 // not a CHECK as --verify-heap is only available in debug mode. |
2498 ASSERT(v8::internal::FLAG_verify_heap); | 2498 ASSERT(v8::internal::FLAG_verify_heap); |
2499 | 2499 |
2500 // Register a debug event listener which sets the break flag and counts. | 2500 // Register a debug event listener which sets the break flag and counts. |
2501 v8::Debug::AddDebugEventListener(DebugEventBreak); | 2501 v8::Debug::SetDebugEventListener(DebugEventBreak); |
2502 | 2502 |
2503 // Create a function for testing stepping. | 2503 // Create a function for testing stepping. |
2504 const char* src = "function f0() {}" | 2504 const char* src = "function f0() {}" |
2505 "function f1(x1) {}" | 2505 "function f1(x1) {}" |
2506 "function f2(x1,x2) {}" | 2506 "function f2(x1,x2) {}" |
2507 "function f3(x1,x2,x3) {}"; | 2507 "function f3(x1,x2,x3) {}"; |
2508 v8::Local<v8::Function> f0 = CompileFunction(&env, src, "f0"); | 2508 v8::Local<v8::Function> f0 = CompileFunction(&env, src, "f0"); |
2509 v8::Local<v8::Function> f1 = CompileFunction(&env, src, "f1"); | 2509 v8::Local<v8::Function> f1 = CompileFunction(&env, src, "f1"); |
2510 v8::Local<v8::Function> f2 = CompileFunction(&env, src, "f2"); | 2510 v8::Local<v8::Function> f2 = CompileFunction(&env, src, "f2"); |
2511 v8::Local<v8::Function> f3 = CompileFunction(&env, src, "f3"); | 2511 v8::Local<v8::Function> f3 = CompileFunction(&env, src, "f3"); |
(...skipping 19 matching lines...) Expand all Loading... |
2531 f0->Call(env->Global(), i, argv); | 2531 f0->Call(env->Global(), i, argv); |
2532 f1->Call(env->Global(), i, argv); | 2532 f1->Call(env->Global(), i, argv); |
2533 f2->Call(env->Global(), i, argv); | 2533 f2->Call(env->Global(), i, argv); |
2534 f3->Call(env->Global(), i, argv); | 2534 f3->Call(env->Global(), i, argv); |
2535 } | 2535 } |
2536 | 2536 |
2537 // One break for each function called. | 2537 // One break for each function called. |
2538 CHECK_EQ(4 * ARRAY_SIZE(argv), break_point_hit_count); | 2538 CHECK_EQ(4 * ARRAY_SIZE(argv), break_point_hit_count); |
2539 | 2539 |
2540 // Get rid of the debug event listener. | 2540 // Get rid of the debug event listener. |
2541 v8::Debug::RemoveDebugEventListener(DebugEventBreak); | 2541 v8::Debug::SetDebugEventListener(NULL); |
2542 } | 2542 } |
2543 | 2543 |
2544 | 2544 |
2545 // Test to ensure that JavaScript code keeps running while the debug break | 2545 // Test to ensure that JavaScript code keeps running while the debug break |
2546 // through the stack limit flag is set but breaks are disabled. | 2546 // through the stack limit flag is set but breaks are disabled. |
2547 TEST(DisableBreak) { | 2547 TEST(DisableBreak) { |
2548 v8::HandleScope scope; | 2548 v8::HandleScope scope; |
2549 DebugLocalContext env; | 2549 DebugLocalContext env; |
2550 | 2550 |
2551 // Register a debug event listener which sets the break flag and counts. | 2551 // Register a debug event listener which sets the break flag and counts. |
2552 v8::Debug::AddDebugEventListener(DebugEventCounter); | 2552 v8::Debug::SetDebugEventListener(DebugEventCounter); |
2553 | 2553 |
2554 // Create a function for testing stepping. | 2554 // Create a function for testing stepping. |
2555 const char* src = "function f() {g()};function g(){i=0; while(i<10){i++}}"; | 2555 const char* src = "function f() {g()};function g(){i=0; while(i<10){i++}}"; |
2556 v8::Local<v8::Function> f = CompileFunction(&env, src, "f"); | 2556 v8::Local<v8::Function> f = CompileFunction(&env, src, "f"); |
2557 | 2557 |
2558 // Set the debug break flag. | 2558 // Set the debug break flag. |
2559 v8::Debug::DebugBreak(); | 2559 v8::Debug::DebugBreak(); |
2560 | 2560 |
2561 // Call all functions with different argument count. | 2561 // Call all functions with different argument count. |
2562 break_point_hit_count = 0; | 2562 break_point_hit_count = 0; |
2563 f->Call(env->Global(), 0, NULL); | 2563 f->Call(env->Global(), 0, NULL); |
2564 CHECK_EQ(1, break_point_hit_count); | 2564 CHECK_EQ(1, break_point_hit_count); |
2565 | 2565 |
2566 { | 2566 { |
2567 v8::Debug::DebugBreak(); | 2567 v8::Debug::DebugBreak(); |
2568 v8::internal::DisableBreak disable_break(true); | 2568 v8::internal::DisableBreak disable_break(true); |
2569 f->Call(env->Global(), 0, NULL); | 2569 f->Call(env->Global(), 0, NULL); |
2570 CHECK_EQ(1, break_point_hit_count); | 2570 CHECK_EQ(1, break_point_hit_count); |
2571 } | 2571 } |
2572 | 2572 |
2573 f->Call(env->Global(), 0, NULL); | 2573 f->Call(env->Global(), 0, NULL); |
2574 CHECK_EQ(2, break_point_hit_count); | 2574 CHECK_EQ(2, break_point_hit_count); |
2575 | 2575 |
2576 // Get rid of the debug event listener. | 2576 // Get rid of the debug event listener. |
2577 v8::Debug::RemoveDebugEventListener(DebugEventBreak); | 2577 v8::Debug::SetDebugEventListener(NULL); |
2578 } | 2578 } |
2579 | 2579 |
2580 | 2580 |
2581 static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) { | 2581 static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) { |
2582 v8::Handle<v8::Array> result = v8::Array::New(3); | 2582 v8::Handle<v8::Array> result = v8::Array::New(3); |
2583 result->Set(v8::Integer::New(0), v8::String::New("a")); | 2583 result->Set(v8::Integer::New(0), v8::String::New("a")); |
2584 result->Set(v8::Integer::New(1), v8::String::New("b")); | 2584 result->Set(v8::Integer::New(1), v8::String::New("b")); |
2585 result->Set(v8::Integer::New(2), v8::String::New("c")); | 2585 result->Set(v8::Integer::New(2), v8::String::New("c")); |
2586 return result; | 2586 return result; |
2587 } | 2587 } |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3329 } | 3329 } |
3330 | 3330 |
3331 | 3331 |
3332 static void DummyDebugEventListener(v8::DebugEvent event, | 3332 static void DummyDebugEventListener(v8::DebugEvent event, |
3333 v8::Handle<v8::Object> exec_state, | 3333 v8::Handle<v8::Object> exec_state, |
3334 v8::Handle<v8::Object> event_data, | 3334 v8::Handle<v8::Object> event_data, |
3335 v8::Handle<v8::Value> data) { | 3335 v8::Handle<v8::Value> data) { |
3336 } | 3336 } |
3337 | 3337 |
3338 | 3338 |
3339 TEST(AddDebugEventListenerOnUninitializedVM) { | 3339 TEST(SetDebugEventListenerOnUninitializedVM) { |
3340 v8::Debug::AddDebugEventListener(DummyDebugEventListener); | 3340 v8::Debug::SetDebugEventListener(DummyDebugEventListener); |
3341 } | 3341 } |
3342 | 3342 |
3343 | 3343 |
3344 static void DummyMessageHandler(const uint16_t* message, | 3344 static void DummyMessageHandler(const uint16_t* message, |
3345 int length, void *data) { | 3345 int length, void *data) { |
3346 } | 3346 } |
3347 | 3347 |
3348 | 3348 |
3349 TEST(SetMessageHandlerOnUninitializedVM) { | 3349 TEST(SetMessageHandlerOnUninitializedVM) { |
3350 v8::Debug::SetMessageHandler(DummyMessageHandler); | 3350 v8::Debug::SetMessageHandler(DummyMessageHandler); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 " CheckSourceLine(2)\n" | 3499 " CheckSourceLine(2)\n" |
3500 " CheckSourceLine(3)\n" | 3500 " CheckSourceLine(3)\n" |
3501 "}; f()"))->Run(); | 3501 "}; f()"))->Run(); |
3502 | 3502 |
3503 // Test that a parameter can be passed to a function called in the debugger. | 3503 // Test that a parameter can be passed to a function called in the debugger. |
3504 v8::Script::Compile(v8::String::New("CheckDataParameter()"))->Run(); | 3504 v8::Script::Compile(v8::String::New("CheckDataParameter()"))->Run(); |
3505 | 3505 |
3506 // Test that a function with closure can be run in the debugger. | 3506 // Test that a function with closure can be run in the debugger. |
3507 v8::Script::Compile(v8::String::New("CheckClosure()"))->Run(); | 3507 v8::Script::Compile(v8::String::New("CheckClosure()"))->Run(); |
3508 } | 3508 } |
OLD | NEW |