| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 using ::v8::internal::Code; | 46 using ::v8::internal::Code; |
| 47 using ::v8::internal::Debug; | 47 using ::v8::internal::Debug; |
| 48 using ::v8::internal::Debugger; | 48 using ::v8::internal::Debugger; |
| 49 using ::v8::internal::CommandMessage; | 49 using ::v8::internal::CommandMessage; |
| 50 using ::v8::internal::CommandMessageQueue; | 50 using ::v8::internal::CommandMessageQueue; |
| 51 using ::v8::internal::StepAction; | 51 using ::v8::internal::StepAction; |
| 52 using ::v8::internal::StepIn; // From StepAction enum | 52 using ::v8::internal::StepIn; // From StepAction enum |
| 53 using ::v8::internal::StepNext; // From StepAction enum | 53 using ::v8::internal::StepNext; // From StepAction enum |
| 54 using ::v8::internal::StepOut; // From StepAction enum | 54 using ::v8::internal::StepOut; // From StepAction enum |
| 55 using ::v8::internal::Vector; | 55 using ::v8::internal::Vector; |
| 56 | 56 using ::v8::internal::StrLength; |
| 57 | 57 |
| 58 // Size of temp buffer for formatting small strings. | 58 // Size of temp buffer for formatting small strings. |
| 59 #define SMALL_STRING_BUFFER_SIZE 80 | 59 #define SMALL_STRING_BUFFER_SIZE 80 |
| 60 | 60 |
| 61 // --- A d d i t i o n a l C h e c k H e l p e r s | 61 // --- A d d i t i o n a l C h e c k H e l p e r s |
| 62 | 62 |
| 63 | 63 |
| 64 // Helper function used by the CHECK_EQ function when given Address | 64 // Helper function used by the CHECK_EQ function when given Address |
| 65 // arguments. Should not be called directly. | 65 // arguments. Should not be called directly. |
| 66 static inline void CheckEqualsHelper(const char* file, int line, | 66 static inline void CheckEqualsHelper(const char* file, int line, |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 static void DebugEventStepSequence(v8::DebugEvent event, | 793 static void DebugEventStepSequence(v8::DebugEvent event, |
| 794 v8::Handle<v8::Object> exec_state, | 794 v8::Handle<v8::Object> exec_state, |
| 795 v8::Handle<v8::Object> event_data, | 795 v8::Handle<v8::Object> event_data, |
| 796 v8::Handle<v8::Value> data) { | 796 v8::Handle<v8::Value> data) { |
| 797 // When hitting a debug event listener there must be a break set. | 797 // When hitting a debug event listener there must be a break set. |
| 798 CHECK_NE(v8::internal::Debug::break_id(), 0); | 798 CHECK_NE(v8::internal::Debug::break_id(), 0); |
| 799 | 799 |
| 800 if (event == v8::Break || event == v8::Exception) { | 800 if (event == v8::Break || event == v8::Exception) { |
| 801 // Check that the current function is the expected. | 801 // Check that the current function is the expected. |
| 802 CHECK(break_point_hit_count < | 802 CHECK(break_point_hit_count < |
| 803 static_cast<int>(strlen(expected_step_sequence))); | 803 StrLength(expected_step_sequence)); |
| 804 const int argc = 1; | 804 const int argc = 1; |
| 805 v8::Handle<v8::Value> argv[argc] = { exec_state }; | 805 v8::Handle<v8::Value> argv[argc] = { exec_state }; |
| 806 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, | 806 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, |
| 807 argc, argv); | 807 argc, argv); |
| 808 CHECK(result->IsString()); | 808 CHECK(result->IsString()); |
| 809 v8::String::AsciiValue function_name(result->ToString()); | 809 v8::String::AsciiValue function_name(result->ToString()); |
| 810 CHECK_EQ(1, strlen(*function_name)); | 810 CHECK_EQ(1, StrLength(*function_name)); |
| 811 CHECK_EQ((*function_name)[0], | 811 CHECK_EQ((*function_name)[0], |
| 812 expected_step_sequence[break_point_hit_count]); | 812 expected_step_sequence[break_point_hit_count]); |
| 813 | 813 |
| 814 // Perform step. | 814 // Perform step. |
| 815 break_point_hit_count++; | 815 break_point_hit_count++; |
| 816 PrepareStep(step_action); | 816 PrepareStep(step_action); |
| 817 } | 817 } |
| 818 } | 818 } |
| 819 | 819 |
| 820 | 820 |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 | 1924 |
| 1925 // Compile the script and get the function. | 1925 // Compile the script and get the function. |
| 1926 break_point_hit_count = 0; | 1926 break_point_hit_count = 0; |
| 1927 v8::ScriptOrigin origin(v8::String::New("test.html"), v8::Integer::New(0)); | 1927 v8::ScriptOrigin origin(v8::String::New("test.html"), v8::Integer::New(0)); |
| 1928 v8::Script::Compile(script, &origin)->Run(); | 1928 v8::Script::Compile(script, &origin)->Run(); |
| 1929 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 1929 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); |
| 1930 g = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g"))); | 1930 g = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g"))); |
| 1931 | 1931 |
| 1932 // Chesk that a break point was hit when the script was run. | 1932 // Chesk that a break point was hit when the script was run. |
| 1933 CHECK_EQ(1, break_point_hit_count); | 1933 CHECK_EQ(1, break_point_hit_count); |
| 1934 CHECK_EQ(0, strlen(last_function_hit)); | 1934 CHECK_EQ(0, StrLength(last_function_hit)); |
| 1935 | 1935 |
| 1936 // Call f and check that the script break point. | 1936 // Call f and check that the script break point. |
| 1937 f->Call(env->Global(), 0, NULL); | 1937 f->Call(env->Global(), 0, NULL); |
| 1938 CHECK_EQ(2, break_point_hit_count); | 1938 CHECK_EQ(2, break_point_hit_count); |
| 1939 CHECK_EQ("f", last_function_hit); | 1939 CHECK_EQ("f", last_function_hit); |
| 1940 | 1940 |
| 1941 // Call g and check that the script break point. | 1941 // Call g and check that the script break point. |
| 1942 g->Call(env->Global(), 0, NULL); | 1942 g->Call(env->Global(), 0, NULL); |
| 1943 CHECK_EQ(3, break_point_hit_count); | 1943 CHECK_EQ(3, break_point_hit_count); |
| 1944 CHECK_EQ("g", last_function_hit); | 1944 CHECK_EQ("g", last_function_hit); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1960 int sbp5 = SetScriptBreakPointByNameFromJS("test.html", 4, -1); | 1960 int sbp5 = SetScriptBreakPointByNameFromJS("test.html", 4, -1); |
| 1961 break_point_hit_count = 0; | 1961 break_point_hit_count = 0; |
| 1962 f->Call(env->Global(), 0, NULL); | 1962 f->Call(env->Global(), 0, NULL); |
| 1963 g->Call(env->Global(), 0, NULL); | 1963 g->Call(env->Global(), 0, NULL); |
| 1964 CHECK_EQ(0, break_point_hit_count); | 1964 CHECK_EQ(0, break_point_hit_count); |
| 1965 | 1965 |
| 1966 // Reload the script which should hit two break points. | 1966 // Reload the script which should hit two break points. |
| 1967 break_point_hit_count = 0; | 1967 break_point_hit_count = 0; |
| 1968 v8::Script::Compile(script, &origin)->Run(); | 1968 v8::Script::Compile(script, &origin)->Run(); |
| 1969 CHECK_EQ(2, break_point_hit_count); | 1969 CHECK_EQ(2, break_point_hit_count); |
| 1970 CHECK_EQ(0, strlen(last_function_hit)); | 1970 CHECK_EQ(0, StrLength(last_function_hit)); |
| 1971 | 1971 |
| 1972 // Set a break point in the code after the last function decleration. | 1972 // Set a break point in the code after the last function decleration. |
| 1973 int sbp6 = SetScriptBreakPointByNameFromJS("test.html", 12, -1); | 1973 int sbp6 = SetScriptBreakPointByNameFromJS("test.html", 12, -1); |
| 1974 | 1974 |
| 1975 // Reload the script which should hit three break points. | 1975 // Reload the script which should hit three break points. |
| 1976 break_point_hit_count = 0; | 1976 break_point_hit_count = 0; |
| 1977 v8::Script::Compile(script, &origin)->Run(); | 1977 v8::Script::Compile(script, &origin)->Run(); |
| 1978 CHECK_EQ(3, break_point_hit_count); | 1978 CHECK_EQ(3, break_point_hit_count); |
| 1979 CHECK_EQ(0, strlen(last_function_hit)); | 1979 CHECK_EQ(0, StrLength(last_function_hit)); |
| 1980 | 1980 |
| 1981 // Clear the last break points, and reload the script which should not hit any | 1981 // Clear the last break points, and reload the script which should not hit any |
| 1982 // break points. | 1982 // break points. |
| 1983 ClearBreakPointFromJS(sbp1); | 1983 ClearBreakPointFromJS(sbp1); |
| 1984 ClearBreakPointFromJS(sbp5); | 1984 ClearBreakPointFromJS(sbp5); |
| 1985 ClearBreakPointFromJS(sbp6); | 1985 ClearBreakPointFromJS(sbp6); |
| 1986 break_point_hit_count = 0; | 1986 break_point_hit_count = 0; |
| 1987 v8::Script::Compile(script, &origin)->Run(); | 1987 v8::Script::Compile(script, &origin)->Run(); |
| 1988 CHECK_EQ(0, break_point_hit_count); | 1988 CHECK_EQ(0, break_point_hit_count); |
| 1989 | 1989 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 "function b() {c();}; " | 2485 "function b() {c();}; " |
| 2486 "function c() {}; "; | 2486 "function c() {}; "; |
| 2487 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); | 2487 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); |
| 2488 SetBreakPoint(a, 0); | 2488 SetBreakPoint(a, 0); |
| 2489 | 2489 |
| 2490 // Step through invocation of a with step in. | 2490 // Step through invocation of a with step in. |
| 2491 step_action = StepIn; | 2491 step_action = StepIn; |
| 2492 break_point_hit_count = 0; | 2492 break_point_hit_count = 0; |
| 2493 expected_step_sequence = "abcbaca"; | 2493 expected_step_sequence = "abcbaca"; |
| 2494 a->Call(env->Global(), 0, NULL); | 2494 a->Call(env->Global(), 0, NULL); |
| 2495 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2495 CHECK_EQ(StrLength(expected_step_sequence), |
| 2496 break_point_hit_count); |
| 2496 | 2497 |
| 2497 // Step through invocation of a with step next. | 2498 // Step through invocation of a with step next. |
| 2498 step_action = StepNext; | 2499 step_action = StepNext; |
| 2499 break_point_hit_count = 0; | 2500 break_point_hit_count = 0; |
| 2500 expected_step_sequence = "aaa"; | 2501 expected_step_sequence = "aaa"; |
| 2501 a->Call(env->Global(), 0, NULL); | 2502 a->Call(env->Global(), 0, NULL); |
| 2502 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2503 CHECK_EQ(StrLength(expected_step_sequence), |
| 2504 break_point_hit_count); |
| 2503 | 2505 |
| 2504 // Step through invocation of a with step out. | 2506 // Step through invocation of a with step out. |
| 2505 step_action = StepOut; | 2507 step_action = StepOut; |
| 2506 break_point_hit_count = 0; | 2508 break_point_hit_count = 0; |
| 2507 expected_step_sequence = "a"; | 2509 expected_step_sequence = "a"; |
| 2508 a->Call(env->Global(), 0, NULL); | 2510 a->Call(env->Global(), 0, NULL); |
| 2509 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2511 CHECK_EQ(StrLength(expected_step_sequence), |
| 2512 break_point_hit_count); |
| 2510 | 2513 |
| 2511 // Get rid of the debug event listener. | 2514 // Get rid of the debug event listener. |
| 2512 v8::Debug::SetDebugEventListener(NULL); | 2515 v8::Debug::SetDebugEventListener(NULL); |
| 2513 CheckDebuggerUnloaded(); | 2516 CheckDebuggerUnloaded(); |
| 2514 } | 2517 } |
| 2515 | 2518 |
| 2516 | 2519 |
| 2517 TEST(StepInOutTree) { | 2520 TEST(StepInOutTree) { |
| 2518 v8::HandleScope scope; | 2521 v8::HandleScope scope; |
| 2519 DebugLocalContext env; | 2522 DebugLocalContext env; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2532 "function c(x) {}; " | 2535 "function c(x) {}; " |
| 2533 "function d() {}; "; | 2536 "function d() {}; "; |
| 2534 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); | 2537 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); |
| 2535 SetBreakPoint(a, 0); | 2538 SetBreakPoint(a, 0); |
| 2536 | 2539 |
| 2537 // Step through invocation of a with step in. | 2540 // Step through invocation of a with step in. |
| 2538 step_action = StepIn; | 2541 step_action = StepIn; |
| 2539 break_point_hit_count = 0; | 2542 break_point_hit_count = 0; |
| 2540 expected_step_sequence = "adacadabcbadacada"; | 2543 expected_step_sequence = "adacadabcbadacada"; |
| 2541 a->Call(env->Global(), 0, NULL); | 2544 a->Call(env->Global(), 0, NULL); |
| 2542 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2545 CHECK_EQ(StrLength(expected_step_sequence), |
| 2546 break_point_hit_count); |
| 2543 | 2547 |
| 2544 // Step through invocation of a with step next. | 2548 // Step through invocation of a with step next. |
| 2545 step_action = StepNext; | 2549 step_action = StepNext; |
| 2546 break_point_hit_count = 0; | 2550 break_point_hit_count = 0; |
| 2547 expected_step_sequence = "aaaa"; | 2551 expected_step_sequence = "aaaa"; |
| 2548 a->Call(env->Global(), 0, NULL); | 2552 a->Call(env->Global(), 0, NULL); |
| 2549 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2553 CHECK_EQ(StrLength(expected_step_sequence), |
| 2554 break_point_hit_count); |
| 2550 | 2555 |
| 2551 // Step through invocation of a with step out. | 2556 // Step through invocation of a with step out. |
| 2552 step_action = StepOut; | 2557 step_action = StepOut; |
| 2553 break_point_hit_count = 0; | 2558 break_point_hit_count = 0; |
| 2554 expected_step_sequence = "a"; | 2559 expected_step_sequence = "a"; |
| 2555 a->Call(env->Global(), 0, NULL); | 2560 a->Call(env->Global(), 0, NULL); |
| 2556 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2561 CHECK_EQ(StrLength(expected_step_sequence), |
| 2562 break_point_hit_count); |
| 2557 | 2563 |
| 2558 // Get rid of the debug event listener. | 2564 // Get rid of the debug event listener. |
| 2559 v8::Debug::SetDebugEventListener(NULL); | 2565 v8::Debug::SetDebugEventListener(NULL); |
| 2560 CheckDebuggerUnloaded(true); | 2566 CheckDebuggerUnloaded(true); |
| 2561 } | 2567 } |
| 2562 | 2568 |
| 2563 | 2569 |
| 2564 TEST(StepInOutBranch) { | 2570 TEST(StepInOutBranch) { |
| 2565 v8::HandleScope scope; | 2571 v8::HandleScope scope; |
| 2566 DebugLocalContext env; | 2572 DebugLocalContext env; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2578 "function b(x) {if(x){c();};}; " | 2584 "function b(x) {if(x){c();};}; " |
| 2579 "function c() {}; "; | 2585 "function c() {}; "; |
| 2580 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); | 2586 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); |
| 2581 SetBreakPoint(a, 0); | 2587 SetBreakPoint(a, 0); |
| 2582 | 2588 |
| 2583 // Step through invocation of a. | 2589 // Step through invocation of a. |
| 2584 step_action = StepIn; | 2590 step_action = StepIn; |
| 2585 break_point_hit_count = 0; | 2591 break_point_hit_count = 0; |
| 2586 expected_step_sequence = "abaca"; | 2592 expected_step_sequence = "abaca"; |
| 2587 a->Call(env->Global(), 0, NULL); | 2593 a->Call(env->Global(), 0, NULL); |
| 2588 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2594 CHECK_EQ(StrLength(expected_step_sequence), |
| 2595 break_point_hit_count); |
| 2589 | 2596 |
| 2590 // Get rid of the debug event listener. | 2597 // Get rid of the debug event listener. |
| 2591 v8::Debug::SetDebugEventListener(NULL); | 2598 v8::Debug::SetDebugEventListener(NULL); |
| 2592 CheckDebuggerUnloaded(); | 2599 CheckDebuggerUnloaded(); |
| 2593 } | 2600 } |
| 2594 | 2601 |
| 2595 | 2602 |
| 2596 // Test that step in does not step into native functions. | 2603 // Test that step in does not step into native functions. |
| 2597 TEST(DebugStepNatives) { | 2604 TEST(DebugStepNatives) { |
| 2598 v8::HandleScope scope; | 2605 v8::HandleScope scope; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2945 "function g() { h(); }; " | 2952 "function g() { h(); }; " |
| 2946 "function h() { x = 1; throw 1; }; "; | 2953 "function h() { x = 1; throw 1; }; "; |
| 2947 | 2954 |
| 2948 // Step through invocation of a. | 2955 // Step through invocation of a. |
| 2949 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); | 2956 v8::Local<v8::Function> a = CompileFunction(&env, src, "a"); |
| 2950 SetBreakPoint(a, 0); | 2957 SetBreakPoint(a, 0); |
| 2951 step_action = StepIn; | 2958 step_action = StepIn; |
| 2952 break_point_hit_count = 0; | 2959 break_point_hit_count = 0; |
| 2953 expected_step_sequence = "aa"; | 2960 expected_step_sequence = "aa"; |
| 2954 a->Call(env->Global(), 0, NULL); | 2961 a->Call(env->Global(), 0, NULL); |
| 2955 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2962 CHECK_EQ(StrLength(expected_step_sequence), |
| 2963 break_point_hit_count); |
| 2956 | 2964 |
| 2957 // Step through invocation of b + c. | 2965 // Step through invocation of b + c. |
| 2958 v8::Local<v8::Function> b = CompileFunction(&env, src, "b"); | 2966 v8::Local<v8::Function> b = CompileFunction(&env, src, "b"); |
| 2959 SetBreakPoint(b, 0); | 2967 SetBreakPoint(b, 0); |
| 2960 step_action = StepIn; | 2968 step_action = StepIn; |
| 2961 break_point_hit_count = 0; | 2969 break_point_hit_count = 0; |
| 2962 expected_step_sequence = "bcc"; | 2970 expected_step_sequence = "bcc"; |
| 2963 b->Call(env->Global(), 0, NULL); | 2971 b->Call(env->Global(), 0, NULL); |
| 2964 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2972 CHECK_EQ(StrLength(expected_step_sequence), |
| 2973 break_point_hit_count); |
| 2965 | 2974 |
| 2966 // Step through invocation of d + e. | 2975 // Step through invocation of d + e. |
| 2967 v8::Local<v8::Function> d = CompileFunction(&env, src, "d"); | 2976 v8::Local<v8::Function> d = CompileFunction(&env, src, "d"); |
| 2968 SetBreakPoint(d, 0); | 2977 SetBreakPoint(d, 0); |
| 2969 ChangeBreakOnException(false, true); | 2978 ChangeBreakOnException(false, true); |
| 2970 step_action = StepIn; | 2979 step_action = StepIn; |
| 2971 break_point_hit_count = 0; | 2980 break_point_hit_count = 0; |
| 2972 expected_step_sequence = "dded"; | 2981 expected_step_sequence = "dded"; |
| 2973 d->Call(env->Global(), 0, NULL); | 2982 d->Call(env->Global(), 0, NULL); |
| 2974 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2983 CHECK_EQ(StrLength(expected_step_sequence), |
| 2984 break_point_hit_count); |
| 2975 | 2985 |
| 2976 // Step through invocation of d + e now with break on caught exceptions. | 2986 // Step through invocation of d + e now with break on caught exceptions. |
| 2977 ChangeBreakOnException(true, true); | 2987 ChangeBreakOnException(true, true); |
| 2978 step_action = StepIn; | 2988 step_action = StepIn; |
| 2979 break_point_hit_count = 0; | 2989 break_point_hit_count = 0; |
| 2980 expected_step_sequence = "ddeed"; | 2990 expected_step_sequence = "ddeed"; |
| 2981 d->Call(env->Global(), 0, NULL); | 2991 d->Call(env->Global(), 0, NULL); |
| 2982 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 2992 CHECK_EQ(StrLength(expected_step_sequence), |
| 2993 break_point_hit_count); |
| 2983 | 2994 |
| 2984 // Step through invocation of f + g + h. | 2995 // Step through invocation of f + g + h. |
| 2985 v8::Local<v8::Function> f = CompileFunction(&env, src, "f"); | 2996 v8::Local<v8::Function> f = CompileFunction(&env, src, "f"); |
| 2986 SetBreakPoint(f, 0); | 2997 SetBreakPoint(f, 0); |
| 2987 ChangeBreakOnException(false, true); | 2998 ChangeBreakOnException(false, true); |
| 2988 step_action = StepIn; | 2999 step_action = StepIn; |
| 2989 break_point_hit_count = 0; | 3000 break_point_hit_count = 0; |
| 2990 expected_step_sequence = "ffghf"; | 3001 expected_step_sequence = "ffghf"; |
| 2991 f->Call(env->Global(), 0, NULL); | 3002 f->Call(env->Global(), 0, NULL); |
| 2992 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 3003 CHECK_EQ(StrLength(expected_step_sequence), |
| 3004 break_point_hit_count); |
| 2993 | 3005 |
| 2994 // Step through invocation of f + g + h now with break on caught exceptions. | 3006 // Step through invocation of f + g + h now with break on caught exceptions. |
| 2995 ChangeBreakOnException(true, true); | 3007 ChangeBreakOnException(true, true); |
| 2996 step_action = StepIn; | 3008 step_action = StepIn; |
| 2997 break_point_hit_count = 0; | 3009 break_point_hit_count = 0; |
| 2998 expected_step_sequence = "ffghhf"; | 3010 expected_step_sequence = "ffghhf"; |
| 2999 f->Call(env->Global(), 0, NULL); | 3011 f->Call(env->Global(), 0, NULL); |
| 3000 CHECK_EQ(strlen(expected_step_sequence), break_point_hit_count); | 3012 CHECK_EQ(StrLength(expected_step_sequence), |
| 3013 break_point_hit_count); |
| 3001 | 3014 |
| 3002 // Get rid of the debug event listener. | 3015 // Get rid of the debug event listener. |
| 3003 v8::Debug::SetDebugEventListener(NULL); | 3016 v8::Debug::SetDebugEventListener(NULL); |
| 3004 CheckDebuggerUnloaded(); | 3017 CheckDebuggerUnloaded(); |
| 3005 } | 3018 } |
| 3006 | 3019 |
| 3007 | 3020 |
| 3008 TEST(DebugBreak) { | 3021 TEST(DebugBreak) { |
| 3009 v8::HandleScope scope; | 3022 v8::HandleScope scope; |
| 3010 DebugLocalContext env; | 3023 DebugLocalContext env; |
| (...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4716 buffer[1] = ':'; | 4729 buffer[1] = ':'; |
| 4717 for (int i = 2; i < kBufferSize - 2; i++) { | 4730 for (int i = 2; i < kBufferSize - 2; i++) { |
| 4718 buffer[i] = 'X'; | 4731 buffer[i] = 'X'; |
| 4719 } | 4732 } |
| 4720 buffer[kBufferSize - 2] = '\r'; | 4733 buffer[kBufferSize - 2] = '\r'; |
| 4721 buffer[kBufferSize - 1] = '\n'; | 4734 buffer[kBufferSize - 1] = '\n'; |
| 4722 client->Send(buffer, kBufferSize); | 4735 client->Send(buffer, kBufferSize); |
| 4723 | 4736 |
| 4724 // Add empty body to request. | 4737 // Add empty body to request. |
| 4725 const char* content_length_zero_header = "Content-Length:0\r\n"; | 4738 const char* content_length_zero_header = "Content-Length:0\r\n"; |
| 4726 client->Send(content_length_zero_header, strlen(content_length_zero_header)); | 4739 client->Send(content_length_zero_header, |
| 4740 StrLength(content_length_zero_header)); |
| 4727 client->Send("\r\n", 2); | 4741 client->Send("\r\n", 2); |
| 4728 | 4742 |
| 4729 // Wait until data is received. | 4743 // Wait until data is received. |
| 4730 server->Join(); | 4744 server->Join(); |
| 4731 | 4745 |
| 4732 // Check for empty body. | 4746 // Check for empty body. |
| 4733 CHECK(server->body() == NULL); | 4747 CHECK(server->body() == NULL); |
| 4734 | 4748 |
| 4735 // Close the client before the server to avoid TIME_WAIT issues. | 4749 // Close the client before the server to avoid TIME_WAIT issues. |
| 4736 client->Shutdown(); | 4750 client->Shutdown(); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5484 break_point_hit_count = 0; | 5498 break_point_hit_count = 0; |
| 5485 max_break_point_hit_count = 10000; // 10000 => infinite loop. | 5499 max_break_point_hit_count = 10000; // 10000 => infinite loop. |
| 5486 foo->Call(env->Global(), 0, NULL); | 5500 foo->Call(env->Global(), 0, NULL); |
| 5487 | 5501 |
| 5488 // When keeping the debug break several break will happen. | 5502 // When keeping the debug break several break will happen. |
| 5489 CHECK_EQ(3, break_point_hit_count); | 5503 CHECK_EQ(3, break_point_hit_count); |
| 5490 | 5504 |
| 5491 v8::Debug::SetDebugEventListener(NULL); | 5505 v8::Debug::SetDebugEventListener(NULL); |
| 5492 CheckDebuggerUnloaded(); | 5506 CheckDebuggerUnloaded(); |
| 5493 } | 5507 } |
| OLD | NEW |