Index: test/cctest/test-debug.cc |
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc |
index 25a75103e3704e5f7938877b8d56fee2ea9b2ffc..e1219b153f117c1ef73c2e81ac122c8ebcd7d9d0 100644 |
--- a/test/cctest/test-debug.cc |
+++ b/test/cctest/test-debug.cc |
@@ -445,6 +445,7 @@ void CheckDebugBreakFunction(DebugLocalContext* env, |
const char* source, const char* name, |
int position, v8::internal::RelocInfo::Mode mode, |
Code* debug_break) { |
+ EnableDebugger(); |
i::Debug* debug = CcTest::i_isolate()->debug(); |
// Create function and set the break point. |
@@ -488,6 +489,8 @@ void CheckDebugBreakFunction(DebugLocalContext* env, |
i::RelocInfo rinfo = location.rinfo(); |
CHECK(!rinfo.IsPatchedReturnSequence()); |
} |
+ |
+ DisableDebugger(); |
} |
@@ -986,12 +989,10 @@ TEST(DebugStub) { |
v8::internal::RelocInfo::CODE_TARGET, |
CcTest::i_isolate()->builtins()->builtin( |
Builtins::kStoreIC_DebugBreak)); |
- CheckDebugBreakFunction(&env, |
- "function f3(){var a=x;}", "f3", |
- 0, |
- v8::internal::RelocInfo::CODE_TARGET, |
- CcTest::i_isolate()->builtins()->builtin( |
- Builtins::kLoadIC_DebugBreak)); |
+ CheckDebugBreakFunction( |
+ &env, "function f3(){x();}", "f3", 0, |
+ v8::internal::RelocInfo::CODE_TARGET, |
+ CcTest::i_isolate()->builtins()->builtin(Builtins::kLoadIC_DebugBreak)); |
// TODO(1240753): Make the test architecture independent or split |
// parts of the debugger into architecture dependent files. This |
@@ -1001,29 +1002,21 @@ TEST(DebugStub) { |
CheckDebugBreakFunction( |
&env, |
"function f4(){var index='propertyName'; var a={}; a[index] = 'x';}", |
- "f4", |
- 0, |
- v8::internal::RelocInfo::CODE_TARGET, |
+ "f4", 39, v8::internal::RelocInfo::CODE_TARGET, |
CcTest::i_isolate()->builtins()->builtin( |
Builtins::kKeyedStoreIC_DebugBreak)); |
CheckDebugBreakFunction( |
&env, |
"function f5(){var index='propertyName'; var a={}; return a[index];}", |
- "f5", |
- 0, |
- v8::internal::RelocInfo::CODE_TARGET, |
+ "f5", 39, v8::internal::RelocInfo::CODE_TARGET, |
CcTest::i_isolate()->builtins()->builtin( |
Builtins::kKeyedLoadIC_DebugBreak)); |
#endif |
- CheckDebugBreakFunction( |
- &env, |
- "function f6(a){return a==null;}", |
- "f6", |
- 0, |
- v8::internal::RelocInfo::CODE_TARGET, |
- CcTest::i_isolate()->builtins()->builtin( |
- Builtins::kCompareNilIC_DebugBreak)); |
+ CheckDebugBreakFunction(&env, "function f6(){(0==null)()}", "f6", 0, |
+ v8::internal::RelocInfo::CODE_TARGET, |
+ CcTest::i_isolate()->builtins()->builtin( |
+ Builtins::kCompareNilIC_DebugBreak)); |
// Check the debug break code stubs for call ICs with different number of |
// parameters. |
@@ -1066,6 +1059,7 @@ TEST(DebugInfo) { |
CHECK_EQ(0, v8::internal::GetDebuggedFunctions()->length()); |
CHECK(!HasDebugInfo(foo)); |
CHECK(!HasDebugInfo(bar)); |
+ EnableDebugger(); |
// One function (foo) is debugged. |
int bp1 = SetBreakPoint(foo, 0); |
CHECK_EQ(1, v8::internal::GetDebuggedFunctions()->length()); |
@@ -1083,6 +1077,7 @@ TEST(DebugInfo) { |
CHECK(HasDebugInfo(bar)); |
// No functions are debugged. |
ClearBreakPoint(bp2); |
+ DisableDebugger(); |
CHECK_EQ(0, v8::internal::GetDebuggedFunctions()->length()); |
CHECK(!HasDebugInfo(foo)); |
CHECK(!HasDebugInfo(bar)); |
@@ -2290,11 +2285,12 @@ TEST(RemoveBreakPointInBreak) { |
v8::Local<v8::Function> foo = |
CompileFunction(&env, "function foo(){a=1;}", "foo"); |
- debug_event_remove_break_point = SetBreakPoint(foo, 0); |
// Register the debug event listener pasing the function |
v8::Debug::SetDebugEventListener(DebugEventRemoveBreakPoint, foo); |
+ debug_event_remove_break_point = SetBreakPoint(foo, 0); |
+ |
break_point_hit_count = 0; |
foo->Call(env->Global(), 0, NULL); |
CHECK_EQ(1, break_point_hit_count); |
@@ -2781,11 +2777,11 @@ TEST(DebugStepLinear) { |
// Run foo to allow it to get optimized. |
CompileRun("a=0; b=0; c=0; foo();"); |
- SetBreakPoint(foo, 3); |
- |
// Register a debug event listener which steps and counts. |
v8::Debug::SetDebugEventListener(DebugEventStep); |
+ SetBreakPoint(foo, 3); |
+ |
step_action = StepIn; |
break_point_hit_count = 0; |
foo->Call(env->Global(), 0, NULL); |
@@ -5579,11 +5575,6 @@ TEST(RecursiveBreakpointsGlobal) { |
} |
-static void DummyDebugEventListener( |
- const v8::Debug::EventDetails& event_details) { |
-} |
- |
- |
TEST(SetDebugEventListenerOnUninitializedVM) { |
v8::Debug::SetDebugEventListener(DummyDebugEventListener); |
} |
@@ -5957,7 +5948,7 @@ TEST(DebugGetLoadedScripts) { |
v8::String::NewExternal(env->GetIsolate(), &source_ext_str); |
v8::Handle<v8::Script> evil_script(v8::Script::Compile(source)); |
// "use" evil_script to make the compiler happy. |
- (void) evil_script; |
+ USE(evil_script); |
Handle<i::ExternalTwoByteString> i_source( |
i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); |
// This situation can happen if source was an external string disposed |
@@ -5966,12 +5957,14 @@ TEST(DebugGetLoadedScripts) { |
bool allow_natives_syntax = i::FLAG_allow_natives_syntax; |
i::FLAG_allow_natives_syntax = true; |
+ EnableDebugger(); |
CompileRun( |
"var scripts = %DebugGetLoadedScripts();" |
"var count = scripts.length;" |
"for (var i = 0; i < count; ++i) {" |
" scripts[i].line_ends;" |
"}"); |
+ DisableDebugger(); |
// Must not crash while accessing line_ends. |
i::FLAG_allow_natives_syntax = allow_natives_syntax; |
@@ -6539,6 +6532,8 @@ TEST(ProvisionalBreakpointOnLineOutOfRange) { |
const char* script = "function f() {};"; |
const char* resource_name = "test_resource"; |
+ v8::Debug::SetMessageHandler(AfterCompileMessageHandler); |
+ |
// Set a couple of provisional breakpoint on lines out of the script lines |
// range. |
int sbp1 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name, |
@@ -6547,7 +6542,6 @@ TEST(ProvisionalBreakpointOnLineOutOfRange) { |
SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name, 5, 5); |
after_compile_message_count = 0; |
- v8::Debug::SetMessageHandler(AfterCompileMessageHandler); |
v8::ScriptOrigin origin( |
v8::String::NewFromUtf8(env->GetIsolate(), resource_name), |