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

Side by Side Diff: test/cctest/test-debug.cc

Issue 2848032: Clear function breakpoints in Debug::HandleWeakDebugInfo callback. (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/debug.cc ('K') | « src/debug.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 // Call f and check that there are still no break points. 2068 // Call f and check that there are still no break points.
2069 break_point_hit_count = 0; 2069 break_point_hit_count = 0;
2070 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); 2070 f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
2071 CHECK_EQ(0, break_point_hit_count); 2071 CHECK_EQ(0, break_point_hit_count);
2072 2072
2073 v8::Debug::SetDebugEventListener(NULL); 2073 v8::Debug::SetDebugEventListener(NULL);
2074 CheckDebuggerUnloaded(); 2074 CheckDebuggerUnloaded();
2075 } 2075 }
2076 2076
2077 2077
2078 // Test that it is possible to add and remove break points in a top level
2079 // function which is already a garbage but is not collected so far.
Søren Thygesen Gjesse 2010/06/30 11:52:23 is already a garbage but is not collected so far->
2080 TEST(ScriptBreakPointTopLevelCrash) {
2081 v8::HandleScope scope;
2082 DebugLocalContext env;
2083 env.ExposeDebug();
2084
2085 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
2086 v8::Undefined());
2087
2088 v8::Local<v8::String> script_source = v8::String::New(
2089 "function f() {\n"
2090 " return 0;\n"
2091 "}\n"
2092 "f()");
2093
2094 int sbp1 = SetScriptBreakPointByNameFromJS("test.html", 3, -1);
2095 {
2096 v8::HandleScope scope;
2097 break_point_hit_count = 0;
2098 v8::Script::Compile(script_source, v8::String::New("test.html"))->Run();
2099 CHECK_EQ(1, break_point_hit_count);
2100 }
2101
2102 int sbp2 = SetScriptBreakPointByNameFromJS("test.html", 3, -1);
2103 ClearBreakPointFromJS(sbp1);
2104 ClearBreakPointFromJS(sbp2);
2105
2106 v8::Debug::SetDebugEventListener(NULL);
2107 CheckDebuggerUnloaded();
2108 }
2109
2110
2078 // Test that it is possible to remove the last break point for a function 2111 // Test that it is possible to remove the last break point for a function
2079 // inside the break handling of that break point. 2112 // inside the break handling of that break point.
2080 TEST(RemoveBreakPointInBreak) { 2113 TEST(RemoveBreakPointInBreak) {
2081 v8::HandleScope scope; 2114 v8::HandleScope scope;
2082 DebugLocalContext env; 2115 DebugLocalContext env;
2083 2116
2084 v8::Local<v8::Function> foo = 2117 v8::Local<v8::Function> foo =
2085 CompileFunction(&env, "function foo(){a=1;}", "foo"); 2118 CompileFunction(&env, "function foo(){a=1;}", "foo");
2086 debug_event_remove_break_point = SetBreakPoint(foo, 0); 2119 debug_event_remove_break_point = SetBreakPoint(foo, 0);
2087 2120
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 2155
2123 // Run function with two debugger statement 2156 // Run function with two debugger statement
2124 foo->Call(env->Global(), 0, NULL); 2157 foo->Call(env->Global(), 0, NULL);
2125 CHECK_EQ(3, break_point_hit_count); 2158 CHECK_EQ(3, break_point_hit_count);
2126 2159
2127 v8::Debug::SetDebugEventListener(NULL); 2160 v8::Debug::SetDebugEventListener(NULL);
2128 CheckDebuggerUnloaded(); 2161 CheckDebuggerUnloaded();
2129 } 2162 }
2130 2163
2131 2164
2132 // Test setting a breakpoint on the debugger statement. 2165 // Test setting a breakpoint on the debugger statement.
2133 TEST(DebuggerStatementBreakpoint) { 2166 TEST(DebuggerStatementBreakpoint) {
2134 break_point_hit_count = 0; 2167 break_point_hit_count = 0;
2135 v8::HandleScope scope; 2168 v8::HandleScope scope;
2136 DebugLocalContext env; 2169 DebugLocalContext env;
2137 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, 2170 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
2138 v8::Undefined()); 2171 v8::Undefined());
2139 v8::Script::Compile(v8::String::New("function foo(){debugger;}"))->Run(); 2172 v8::Script::Compile(v8::String::New("function foo(){debugger;}"))->Run();
2140 v8::Local<v8::Function> foo = 2173 v8::Local<v8::Function> foo =
2141 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo"))); 2174 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
2142 2175
(...skipping 4468 matching lines...) Expand 10 before | Expand all | Expand 10 after
6611 v8::Context::Scope context_scope(expected_context); 6644 v8::Context::Scope context_scope(expected_context);
6612 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); 6645 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run();
6613 expected_context.Dispose(); 6646 expected_context.Dispose();
6614 expected_context.Clear(); 6647 expected_context.Clear();
6615 v8::Debug::SetDebugEventListener(NULL); 6648 v8::Debug::SetDebugEventListener(NULL);
6616 expected_context_data = v8::Handle<v8::Value>(); 6649 expected_context_data = v8::Handle<v8::Value>();
6617 CheckDebuggerUnloaded(); 6650 CheckDebuggerUnloaded();
6618 } 6651 }
6619 6652
6620 #endif // ENABLE_DEBUGGER_SUPPORT 6653 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« src/debug.cc ('K') | « src/debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698