| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 v8::internal::CheckDebuggerUnloaded(check_functions); | 438 v8::internal::CheckDebuggerUnloaded(check_functions); |
| 439 } | 439 } |
| 440 | 440 |
| 441 | 441 |
| 442 // Compile a function, set a break point and check that the call at the break | 442 // Compile a function, set a break point and check that the call at the break |
| 443 // location in the code is the expected debug_break function. | 443 // location in the code is the expected debug_break function. |
| 444 void CheckDebugBreakFunction(DebugLocalContext* env, | 444 void CheckDebugBreakFunction(DebugLocalContext* env, |
| 445 const char* source, const char* name, | 445 const char* source, const char* name, |
| 446 int position, v8::internal::RelocInfo::Mode mode, | 446 int position, v8::internal::RelocInfo::Mode mode, |
| 447 Code* debug_break) { | 447 Code* debug_break) { |
| 448 EnableDebugger(); |
| 448 i::Debug* debug = CcTest::i_isolate()->debug(); | 449 i::Debug* debug = CcTest::i_isolate()->debug(); |
| 449 | 450 |
| 450 // Create function and set the break point. | 451 // Create function and set the break point. |
| 451 Handle<i::JSFunction> fun = | 452 Handle<i::JSFunction> fun = |
| 452 v8::Utils::OpenHandle(*CompileFunction(env, source, name)); | 453 v8::Utils::OpenHandle(*CompileFunction(env, source, name)); |
| 453 int bp = SetBreakPoint(fun, position); | 454 int bp = SetBreakPoint(fun, position); |
| 454 | 455 |
| 455 // Check that the debug break function is as expected. | 456 // Check that the debug break function is as expected. |
| 456 Handle<i::SharedFunctionInfo> shared(fun->shared()); | 457 Handle<i::SharedFunctionInfo> shared(fun->shared()); |
| 457 CHECK(Debug::HasDebugInfo(shared)); | 458 CHECK(Debug::HasDebugInfo(shared)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 481 i::STATEMENT_ALIGNED); | 482 i::STATEMENT_ALIGNED); |
| 482 actual_mode = location.rmode(); | 483 actual_mode = location.rmode(); |
| 483 if (actual_mode == i::RelocInfo::CODE_TARGET_WITH_ID) { | 484 if (actual_mode == i::RelocInfo::CODE_TARGET_WITH_ID) { |
| 484 actual_mode = i::RelocInfo::CODE_TARGET; | 485 actual_mode = i::RelocInfo::CODE_TARGET; |
| 485 } | 486 } |
| 486 CHECK_EQ(mode, actual_mode); | 487 CHECK_EQ(mode, actual_mode); |
| 487 if (mode == i::RelocInfo::JS_RETURN) { | 488 if (mode == i::RelocInfo::JS_RETURN) { |
| 488 i::RelocInfo rinfo = location.rinfo(); | 489 i::RelocInfo rinfo = location.rinfo(); |
| 489 CHECK(!rinfo.IsPatchedReturnSequence()); | 490 CHECK(!rinfo.IsPatchedReturnSequence()); |
| 490 } | 491 } |
| 492 |
| 493 DisableDebugger(); |
| 491 } | 494 } |
| 492 | 495 |
| 493 | 496 |
| 494 // --- D e b u g E v e n t H a n d l e r s | 497 // --- D e b u g E v e n t H a n d l e r s |
| 495 // --- | 498 // --- |
| 496 // --- The different tests uses a number of debug event handlers. | 499 // --- The different tests uses a number of debug event handlers. |
| 497 // --- | 500 // --- |
| 498 | 501 |
| 499 | 502 |
| 500 // Source for the JavaScript function which picks out the function | 503 // Source for the JavaScript function which picks out the function |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 "function f1(){}", "f1", | 982 "function f1(){}", "f1", |
| 980 0, | 983 0, |
| 981 v8::internal::RelocInfo::JS_RETURN, | 984 v8::internal::RelocInfo::JS_RETURN, |
| 982 NULL); | 985 NULL); |
| 983 CheckDebugBreakFunction(&env, | 986 CheckDebugBreakFunction(&env, |
| 984 "function f2(){x=1;}", "f2", | 987 "function f2(){x=1;}", "f2", |
| 985 0, | 988 0, |
| 986 v8::internal::RelocInfo::CODE_TARGET, | 989 v8::internal::RelocInfo::CODE_TARGET, |
| 987 CcTest::i_isolate()->builtins()->builtin( | 990 CcTest::i_isolate()->builtins()->builtin( |
| 988 Builtins::kStoreIC_DebugBreak)); | 991 Builtins::kStoreIC_DebugBreak)); |
| 989 CheckDebugBreakFunction(&env, | 992 CheckDebugBreakFunction( |
| 990 "function f3(){var a=x;}", "f3", | 993 &env, "function f3(){x();}", "f3", 0, |
| 991 0, | 994 v8::internal::RelocInfo::CODE_TARGET, |
| 992 v8::internal::RelocInfo::CODE_TARGET, | 995 CcTest::i_isolate()->builtins()->builtin(Builtins::kLoadIC_DebugBreak)); |
| 993 CcTest::i_isolate()->builtins()->builtin( | |
| 994 Builtins::kLoadIC_DebugBreak)); | |
| 995 | 996 |
| 996 // TODO(1240753): Make the test architecture independent or split | 997 // TODO(1240753): Make the test architecture independent or split |
| 997 // parts of the debugger into architecture dependent files. This | 998 // parts of the debugger into architecture dependent files. This |
| 998 // part currently disabled as it is not portable between IA32/ARM. | 999 // part currently disabled as it is not portable between IA32/ARM. |
| 999 // Currently on ICs for keyed store/load on ARM. | 1000 // Currently on ICs for keyed store/load on ARM. |
| 1000 #if !defined (__arm__) && !defined(__thumb__) | 1001 #if !defined (__arm__) && !defined(__thumb__) |
| 1001 CheckDebugBreakFunction( | 1002 CheckDebugBreakFunction( |
| 1002 &env, | 1003 &env, |
| 1003 "function f4(){var index='propertyName'; var a={}; a[index] = 'x';}", | 1004 "function f4(){var index='propertyName'; var a={}; a[index] = 'x';}", |
| 1004 "f4", | 1005 "f4", 39, v8::internal::RelocInfo::CODE_TARGET, |
| 1005 0, | |
| 1006 v8::internal::RelocInfo::CODE_TARGET, | |
| 1007 CcTest::i_isolate()->builtins()->builtin( | 1006 CcTest::i_isolate()->builtins()->builtin( |
| 1008 Builtins::kKeyedStoreIC_DebugBreak)); | 1007 Builtins::kKeyedStoreIC_DebugBreak)); |
| 1009 CheckDebugBreakFunction( | 1008 CheckDebugBreakFunction( |
| 1010 &env, | 1009 &env, |
| 1011 "function f5(){var index='propertyName'; var a={}; return a[index];}", | 1010 "function f5(){var index='propertyName'; var a={}; return a[index];}", |
| 1012 "f5", | 1011 "f5", 39, v8::internal::RelocInfo::CODE_TARGET, |
| 1013 0, | |
| 1014 v8::internal::RelocInfo::CODE_TARGET, | |
| 1015 CcTest::i_isolate()->builtins()->builtin( | 1012 CcTest::i_isolate()->builtins()->builtin( |
| 1016 Builtins::kKeyedLoadIC_DebugBreak)); | 1013 Builtins::kKeyedLoadIC_DebugBreak)); |
| 1017 #endif | 1014 #endif |
| 1018 | 1015 |
| 1019 CheckDebugBreakFunction( | 1016 CheckDebugBreakFunction(&env, "function f6(){(0==null)()}", "f6", 0, |
| 1020 &env, | 1017 v8::internal::RelocInfo::CODE_TARGET, |
| 1021 "function f6(a){return a==null;}", | 1018 CcTest::i_isolate()->builtins()->builtin( |
| 1022 "f6", | 1019 Builtins::kCompareNilIC_DebugBreak)); |
| 1023 0, | |
| 1024 v8::internal::RelocInfo::CODE_TARGET, | |
| 1025 CcTest::i_isolate()->builtins()->builtin( | |
| 1026 Builtins::kCompareNilIC_DebugBreak)); | |
| 1027 | 1020 |
| 1028 // Check the debug break code stubs for call ICs with different number of | 1021 // Check the debug break code stubs for call ICs with different number of |
| 1029 // parameters. | 1022 // parameters. |
| 1030 // TODO(verwaest): XXX update test. | 1023 // TODO(verwaest): XXX update test. |
| 1031 // Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0); | 1024 // Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0); |
| 1032 // Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1); | 1025 // Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1); |
| 1033 // Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4); | 1026 // Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4); |
| 1034 | 1027 |
| 1035 // CheckDebugBreakFunction(&env, | 1028 // CheckDebugBreakFunction(&env, |
| 1036 // "function f4_0(){x();}", "f4_0", | 1029 // "function f4_0(){x();}", "f4_0", |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1059 v8::HandleScope scope(env->GetIsolate()); | 1052 v8::HandleScope scope(env->GetIsolate()); |
| 1060 // Create a couple of functions for the test. | 1053 // Create a couple of functions for the test. |
| 1061 v8::Local<v8::Function> foo = | 1054 v8::Local<v8::Function> foo = |
| 1062 CompileFunction(&env, "function foo(){}", "foo"); | 1055 CompileFunction(&env, "function foo(){}", "foo"); |
| 1063 v8::Local<v8::Function> bar = | 1056 v8::Local<v8::Function> bar = |
| 1064 CompileFunction(&env, "function bar(){}", "bar"); | 1057 CompileFunction(&env, "function bar(){}", "bar"); |
| 1065 // Initially no functions are debugged. | 1058 // Initially no functions are debugged. |
| 1066 CHECK_EQ(0, v8::internal::GetDebuggedFunctions()->length()); | 1059 CHECK_EQ(0, v8::internal::GetDebuggedFunctions()->length()); |
| 1067 CHECK(!HasDebugInfo(foo)); | 1060 CHECK(!HasDebugInfo(foo)); |
| 1068 CHECK(!HasDebugInfo(bar)); | 1061 CHECK(!HasDebugInfo(bar)); |
| 1062 EnableDebugger(); |
| 1069 // One function (foo) is debugged. | 1063 // One function (foo) is debugged. |
| 1070 int bp1 = SetBreakPoint(foo, 0); | 1064 int bp1 = SetBreakPoint(foo, 0); |
| 1071 CHECK_EQ(1, v8::internal::GetDebuggedFunctions()->length()); | 1065 CHECK_EQ(1, v8::internal::GetDebuggedFunctions()->length()); |
| 1072 CHECK(HasDebugInfo(foo)); | 1066 CHECK(HasDebugInfo(foo)); |
| 1073 CHECK(!HasDebugInfo(bar)); | 1067 CHECK(!HasDebugInfo(bar)); |
| 1074 // Two functions are debugged. | 1068 // Two functions are debugged. |
| 1075 int bp2 = SetBreakPoint(bar, 0); | 1069 int bp2 = SetBreakPoint(bar, 0); |
| 1076 CHECK_EQ(2, v8::internal::GetDebuggedFunctions()->length()); | 1070 CHECK_EQ(2, v8::internal::GetDebuggedFunctions()->length()); |
| 1077 CHECK(HasDebugInfo(foo)); | 1071 CHECK(HasDebugInfo(foo)); |
| 1078 CHECK(HasDebugInfo(bar)); | 1072 CHECK(HasDebugInfo(bar)); |
| 1079 // One function (bar) is debugged. | 1073 // One function (bar) is debugged. |
| 1080 ClearBreakPoint(bp1); | 1074 ClearBreakPoint(bp1); |
| 1081 CHECK_EQ(1, v8::internal::GetDebuggedFunctions()->length()); | 1075 CHECK_EQ(1, v8::internal::GetDebuggedFunctions()->length()); |
| 1082 CHECK(!HasDebugInfo(foo)); | 1076 CHECK(!HasDebugInfo(foo)); |
| 1083 CHECK(HasDebugInfo(bar)); | 1077 CHECK(HasDebugInfo(bar)); |
| 1084 // No functions are debugged. | 1078 // No functions are debugged. |
| 1085 ClearBreakPoint(bp2); | 1079 ClearBreakPoint(bp2); |
| 1080 DisableDebugger(); |
| 1086 CHECK_EQ(0, v8::internal::GetDebuggedFunctions()->length()); | 1081 CHECK_EQ(0, v8::internal::GetDebuggedFunctions()->length()); |
| 1087 CHECK(!HasDebugInfo(foo)); | 1082 CHECK(!HasDebugInfo(foo)); |
| 1088 CHECK(!HasDebugInfo(bar)); | 1083 CHECK(!HasDebugInfo(bar)); |
| 1089 } | 1084 } |
| 1090 | 1085 |
| 1091 | 1086 |
| 1092 // Test that a break point can be set at an IC store location. | 1087 // Test that a break point can be set at an IC store location. |
| 1093 TEST(BreakPointICStore) { | 1088 TEST(BreakPointICStore) { |
| 1094 break_point_hit_count = 0; | 1089 break_point_hit_count = 0; |
| 1095 DebugLocalContext env; | 1090 DebugLocalContext env; |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2283 | 2278 |
| 2284 | 2279 |
| 2285 // Test that it is possible to remove the last break point for a function | 2280 // Test that it is possible to remove the last break point for a function |
| 2286 // inside the break handling of that break point. | 2281 // inside the break handling of that break point. |
| 2287 TEST(RemoveBreakPointInBreak) { | 2282 TEST(RemoveBreakPointInBreak) { |
| 2288 DebugLocalContext env; | 2283 DebugLocalContext env; |
| 2289 v8::HandleScope scope(env->GetIsolate()); | 2284 v8::HandleScope scope(env->GetIsolate()); |
| 2290 | 2285 |
| 2291 v8::Local<v8::Function> foo = | 2286 v8::Local<v8::Function> foo = |
| 2292 CompileFunction(&env, "function foo(){a=1;}", "foo"); | 2287 CompileFunction(&env, "function foo(){a=1;}", "foo"); |
| 2293 debug_event_remove_break_point = SetBreakPoint(foo, 0); | |
| 2294 | 2288 |
| 2295 // Register the debug event listener pasing the function | 2289 // Register the debug event listener pasing the function |
| 2296 v8::Debug::SetDebugEventListener(DebugEventRemoveBreakPoint, foo); | 2290 v8::Debug::SetDebugEventListener(DebugEventRemoveBreakPoint, foo); |
| 2297 | 2291 |
| 2292 debug_event_remove_break_point = SetBreakPoint(foo, 0); |
| 2293 |
| 2298 break_point_hit_count = 0; | 2294 break_point_hit_count = 0; |
| 2299 foo->Call(env->Global(), 0, NULL); | 2295 foo->Call(env->Global(), 0, NULL); |
| 2300 CHECK_EQ(1, break_point_hit_count); | 2296 CHECK_EQ(1, break_point_hit_count); |
| 2301 | 2297 |
| 2302 break_point_hit_count = 0; | 2298 break_point_hit_count = 0; |
| 2303 foo->Call(env->Global(), 0, NULL); | 2299 foo->Call(env->Global(), 0, NULL); |
| 2304 CHECK_EQ(0, break_point_hit_count); | 2300 CHECK_EQ(0, break_point_hit_count); |
| 2305 | 2301 |
| 2306 v8::Debug::SetDebugEventListener(NULL); | 2302 v8::Debug::SetDebugEventListener(NULL); |
| 2307 CheckDebuggerUnloaded(); | 2303 CheckDebuggerUnloaded(); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2774 v8::HandleScope scope(env->GetIsolate()); | 2770 v8::HandleScope scope(env->GetIsolate()); |
| 2775 | 2771 |
| 2776 // Create a function for testing stepping. | 2772 // Create a function for testing stepping. |
| 2777 v8::Local<v8::Function> foo = CompileFunction(&env, | 2773 v8::Local<v8::Function> foo = CompileFunction(&env, |
| 2778 "function foo(){a=1;b=1;c=1;}", | 2774 "function foo(){a=1;b=1;c=1;}", |
| 2779 "foo"); | 2775 "foo"); |
| 2780 | 2776 |
| 2781 // Run foo to allow it to get optimized. | 2777 // Run foo to allow it to get optimized. |
| 2782 CompileRun("a=0; b=0; c=0; foo();"); | 2778 CompileRun("a=0; b=0; c=0; foo();"); |
| 2783 | 2779 |
| 2784 SetBreakPoint(foo, 3); | |
| 2785 | |
| 2786 // Register a debug event listener which steps and counts. | 2780 // Register a debug event listener which steps and counts. |
| 2787 v8::Debug::SetDebugEventListener(DebugEventStep); | 2781 v8::Debug::SetDebugEventListener(DebugEventStep); |
| 2788 | 2782 |
| 2783 SetBreakPoint(foo, 3); |
| 2784 |
| 2789 step_action = StepIn; | 2785 step_action = StepIn; |
| 2790 break_point_hit_count = 0; | 2786 break_point_hit_count = 0; |
| 2791 foo->Call(env->Global(), 0, NULL); | 2787 foo->Call(env->Global(), 0, NULL); |
| 2792 | 2788 |
| 2793 // With stepping all break locations are hit. | 2789 // With stepping all break locations are hit. |
| 2794 CHECK_EQ(4, break_point_hit_count); | 2790 CHECK_EQ(4, break_point_hit_count); |
| 2795 | 2791 |
| 2796 v8::Debug::SetDebugEventListener(NULL); | 2792 v8::Debug::SetDebugEventListener(NULL); |
| 2797 CheckDebuggerUnloaded(); | 2793 CheckDebuggerUnloaded(); |
| 2798 | 2794 |
| (...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5572 TEST(RecursiveBreakpoints) { | 5568 TEST(RecursiveBreakpoints) { |
| 5573 TestRecursiveBreakpointsGeneric(false); | 5569 TestRecursiveBreakpointsGeneric(false); |
| 5574 } | 5570 } |
| 5575 | 5571 |
| 5576 | 5572 |
| 5577 TEST(RecursiveBreakpointsGlobal) { | 5573 TEST(RecursiveBreakpointsGlobal) { |
| 5578 TestRecursiveBreakpointsGeneric(true); | 5574 TestRecursiveBreakpointsGeneric(true); |
| 5579 } | 5575 } |
| 5580 | 5576 |
| 5581 | 5577 |
| 5582 static void DummyDebugEventListener( | |
| 5583 const v8::Debug::EventDetails& event_details) { | |
| 5584 } | |
| 5585 | |
| 5586 | |
| 5587 TEST(SetDebugEventListenerOnUninitializedVM) { | 5578 TEST(SetDebugEventListenerOnUninitializedVM) { |
| 5588 v8::Debug::SetDebugEventListener(DummyDebugEventListener); | 5579 v8::Debug::SetDebugEventListener(DummyDebugEventListener); |
| 5589 } | 5580 } |
| 5590 | 5581 |
| 5591 | 5582 |
| 5592 static void DummyMessageHandler(const v8::Debug::Message& message) { | 5583 static void DummyMessageHandler(const v8::Debug::Message& message) { |
| 5593 } | 5584 } |
| 5594 | 5585 |
| 5595 | 5586 |
| 5596 TEST(SetMessageHandlerOnUninitializedVM) { | 5587 TEST(SetMessageHandlerOnUninitializedVM) { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5950 TEST(DebugGetLoadedScripts) { | 5941 TEST(DebugGetLoadedScripts) { |
| 5951 DebugLocalContext env; | 5942 DebugLocalContext env; |
| 5952 v8::HandleScope scope(env->GetIsolate()); | 5943 v8::HandleScope scope(env->GetIsolate()); |
| 5953 env.ExposeDebug(); | 5944 env.ExposeDebug(); |
| 5954 | 5945 |
| 5955 EmptyExternalStringResource source_ext_str; | 5946 EmptyExternalStringResource source_ext_str; |
| 5956 v8::Local<v8::String> source = | 5947 v8::Local<v8::String> source = |
| 5957 v8::String::NewExternal(env->GetIsolate(), &source_ext_str); | 5948 v8::String::NewExternal(env->GetIsolate(), &source_ext_str); |
| 5958 v8::Handle<v8::Script> evil_script(v8::Script::Compile(source)); | 5949 v8::Handle<v8::Script> evil_script(v8::Script::Compile(source)); |
| 5959 // "use" evil_script to make the compiler happy. | 5950 // "use" evil_script to make the compiler happy. |
| 5960 (void) evil_script; | 5951 USE(evil_script); |
| 5961 Handle<i::ExternalTwoByteString> i_source( | 5952 Handle<i::ExternalTwoByteString> i_source( |
| 5962 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); | 5953 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); |
| 5963 // This situation can happen if source was an external string disposed | 5954 // This situation can happen if source was an external string disposed |
| 5964 // by its owner. | 5955 // by its owner. |
| 5965 i_source->set_resource(0); | 5956 i_source->set_resource(0); |
| 5966 | 5957 |
| 5967 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; | 5958 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; |
| 5968 i::FLAG_allow_natives_syntax = true; | 5959 i::FLAG_allow_natives_syntax = true; |
| 5960 EnableDebugger(); |
| 5969 CompileRun( | 5961 CompileRun( |
| 5970 "var scripts = %DebugGetLoadedScripts();" | 5962 "var scripts = %DebugGetLoadedScripts();" |
| 5971 "var count = scripts.length;" | 5963 "var count = scripts.length;" |
| 5972 "for (var i = 0; i < count; ++i) {" | 5964 "for (var i = 0; i < count; ++i) {" |
| 5973 " scripts[i].line_ends;" | 5965 " scripts[i].line_ends;" |
| 5974 "}"); | 5966 "}"); |
| 5967 DisableDebugger(); |
| 5975 // Must not crash while accessing line_ends. | 5968 // Must not crash while accessing line_ends. |
| 5976 i::FLAG_allow_natives_syntax = allow_natives_syntax; | 5969 i::FLAG_allow_natives_syntax = allow_natives_syntax; |
| 5977 | 5970 |
| 5978 // Some scripts are retrieved - at least the number of native scripts. | 5971 // Some scripts are retrieved - at least the number of native scripts. |
| 5979 CHECK_GT((*env) | 5972 CHECK_GT((*env) |
| 5980 ->Global() | 5973 ->Global() |
| 5981 ->Get(v8::String::NewFromUtf8(env->GetIsolate(), "count")) | 5974 ->Get(v8::String::NewFromUtf8(env->GetIsolate(), "count")) |
| 5982 ->Int32Value(), | 5975 ->Int32Value(), |
| 5983 8); | 5976 8); |
| 5984 } | 5977 } |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6532 | 6525 |
| 6533 // Tests after compile event is sent when there are some provisional | 6526 // Tests after compile event is sent when there are some provisional |
| 6534 // breakpoints out of the scripts lines range. | 6527 // breakpoints out of the scripts lines range. |
| 6535 TEST(ProvisionalBreakpointOnLineOutOfRange) { | 6528 TEST(ProvisionalBreakpointOnLineOutOfRange) { |
| 6536 DebugLocalContext env; | 6529 DebugLocalContext env; |
| 6537 v8::HandleScope scope(env->GetIsolate()); | 6530 v8::HandleScope scope(env->GetIsolate()); |
| 6538 env.ExposeDebug(); | 6531 env.ExposeDebug(); |
| 6539 const char* script = "function f() {};"; | 6532 const char* script = "function f() {};"; |
| 6540 const char* resource_name = "test_resource"; | 6533 const char* resource_name = "test_resource"; |
| 6541 | 6534 |
| 6535 v8::Debug::SetMessageHandler(AfterCompileMessageHandler); |
| 6536 |
| 6542 // Set a couple of provisional breakpoint on lines out of the script lines | 6537 // Set a couple of provisional breakpoint on lines out of the script lines |
| 6543 // range. | 6538 // range. |
| 6544 int sbp1 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name, | 6539 int sbp1 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name, |
| 6545 3, -1 /* no column */); | 6540 3, -1 /* no column */); |
| 6546 int sbp2 = | 6541 int sbp2 = |
| 6547 SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name, 5, 5); | 6542 SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name, 5, 5); |
| 6548 | 6543 |
| 6549 after_compile_message_count = 0; | 6544 after_compile_message_count = 0; |
| 6550 v8::Debug::SetMessageHandler(AfterCompileMessageHandler); | |
| 6551 | 6545 |
| 6552 v8::ScriptOrigin origin( | 6546 v8::ScriptOrigin origin( |
| 6553 v8::String::NewFromUtf8(env->GetIsolate(), resource_name), | 6547 v8::String::NewFromUtf8(env->GetIsolate(), resource_name), |
| 6554 v8::Integer::New(env->GetIsolate(), 10), | 6548 v8::Integer::New(env->GetIsolate(), 10), |
| 6555 v8::Integer::New(env->GetIsolate(), 1)); | 6549 v8::Integer::New(env->GetIsolate(), 1)); |
| 6556 // Compile a script whose first line number is greater than the breakpoints' | 6550 // Compile a script whose first line number is greater than the breakpoints' |
| 6557 // lines. | 6551 // lines. |
| 6558 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script), | 6552 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script), |
| 6559 &origin)->Run(); | 6553 &origin)->Run(); |
| 6560 | 6554 |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7647 "let y = 2; \n" | 7641 "let y = 2; \n" |
| 7648 "debugger; \n" | 7642 "debugger; \n" |
| 7649 "x * y", | 7643 "x * y", |
| 7650 30); | 7644 30); |
| 7651 ExpectInt32( | 7645 ExpectInt32( |
| 7652 "x = 1; y = 2; \n" | 7646 "x = 1; y = 2; \n" |
| 7653 "debugger;" | 7647 "debugger;" |
| 7654 "x * y", | 7648 "x * y", |
| 7655 30); | 7649 30); |
| 7656 } | 7650 } |
| OLD | NEW |