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 5311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5322 if (is_debug_break) { | 5322 if (is_debug_break) { |
5323 i::StackGuard::DebugBreak(); | 5323 i::StackGuard::DebugBreak(); |
5324 } else { | 5324 } else { |
5325 i::StackGuard::Continue(i::DEBUGBREAK); | 5325 i::StackGuard::Continue(i::DEBUGBREAK); |
5326 } | 5326 } |
5327 } | 5327 } |
5328 } | 5328 } |
5329 | 5329 |
5330 | 5330 |
5331 // Test that if DebugBreak is forced it is ignored when code from | 5331 // Test that if DebugBreak is forced it is ignored when code from |
5332 // debug-delay.js is executed. | 5332 // debug-delay.js is executed. |
5333 TEST(NoDebugBreakInAfterCompileMessageHandler) { | 5333 TEST(NoDebugBreakInAfterCompileMessageHandler) { |
5334 v8::HandleScope scope; | 5334 v8::HandleScope scope; |
5335 DebugLocalContext env; | 5335 DebugLocalContext env; |
5336 | 5336 |
5337 // Register a debug event listener which sets the break flag and counts. | 5337 // Register a debug event listener which sets the break flag and counts. |
5338 v8::Debug::SetMessageHandler2(BreakMessageHandler); | 5338 v8::Debug::SetMessageHandler2(BreakMessageHandler); |
5339 | 5339 |
5340 // Set the debug break flag. | 5340 // Set the debug break flag. |
5341 v8::Debug::DebugBreak(); | 5341 v8::Debug::DebugBreak(); |
5342 | 5342 |
5343 // Create a function for testing stepping. | 5343 // Create a function for testing stepping. |
5344 const char* src = "function f() { eval('var x = 10;'); } "; | 5344 const char* src = "function f() { eval('var x = 10;'); } "; |
5345 v8::Local<v8::Function> f = CompileFunction(&env, src, "f"); | 5345 v8::Local<v8::Function> f = CompileFunction(&env, src, "f"); |
5346 | 5346 |
5347 // There should be only one break event. | 5347 // There should be only one break event. |
5348 CHECK_EQ(1, break_point_hit_count); | 5348 CHECK_EQ(1, break_point_hit_count); |
5349 | 5349 |
5350 // Set the debug break flag again. | 5350 // Set the debug break flag again. |
5351 v8::Debug::DebugBreak(); | 5351 v8::Debug::DebugBreak(); |
5352 f->Call(env->Global(), 0, NULL); | 5352 f->Call(env->Global(), 0, NULL); |
5353 // There should be one more break event when the script is evaluated in 'f'. | 5353 // There should be one more break event when the script is evaluated in 'f'. |
5354 CHECK_EQ(2, break_point_hit_count); | 5354 CHECK_EQ(2, break_point_hit_count); |
5355 | 5355 |
5356 // Get rid of the debug message handler. | 5356 // Get rid of the debug message handler. |
5357 v8::Debug::SetMessageHandler2(NULL); | 5357 v8::Debug::SetMessageHandler2(NULL); |
5358 CheckDebuggerUnloaded(); | 5358 CheckDebuggerUnloaded(); |
5359 } | 5359 } |
OLD | NEW |