| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // Create function and set the break point. | 482 // Create function and set the break point. |
| 483 Handle<v8::internal::JSFunction> fun = v8::Utils::OpenHandle( | 483 Handle<v8::internal::JSFunction> fun = v8::Utils::OpenHandle( |
| 484 *CompileFunction(env, source, name)); | 484 *CompileFunction(env, source, name)); |
| 485 int bp = SetBreakPoint(fun, position); | 485 int bp = SetBreakPoint(fun, position); |
| 486 | 486 |
| 487 // Check that the debug break function is as expected. | 487 // Check that the debug break function is as expected. |
| 488 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared()); | 488 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared()); |
| 489 CHECK(Debug::HasDebugInfo(shared)); | 489 CHECK(Debug::HasDebugInfo(shared)); |
| 490 TestBreakLocationIterator it1(Debug::GetDebugInfo(shared)); | 490 TestBreakLocationIterator it1(Debug::GetDebugInfo(shared)); |
| 491 it1.FindBreakLocationFromPosition(position); | 491 it1.FindBreakLocationFromPosition(position); |
| 492 CHECK_EQ(mode, it1.it()->rinfo()->rmode()); | 492 v8::internal::RelocInfo::Mode actual_mode = it1.it()->rinfo()->rmode(); |
| 493 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) { |
| 494 actual_mode = v8::internal::RelocInfo::CODE_TARGET; |
| 495 } |
| 496 CHECK_EQ(mode, actual_mode); |
| 493 if (mode != v8::internal::RelocInfo::JS_RETURN) { | 497 if (mode != v8::internal::RelocInfo::JS_RETURN) { |
| 494 CHECK_EQ(debug_break, | 498 CHECK_EQ(debug_break, |
| 495 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); | 499 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); |
| 496 } else { | 500 } else { |
| 497 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo())); | 501 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo())); |
| 498 } | 502 } |
| 499 | 503 |
| 500 // Clear the break point and check that the debug break function is no longer | 504 // Clear the break point and check that the debug break function is no longer |
| 501 // there | 505 // there |
| 502 ClearBreakPoint(bp); | 506 ClearBreakPoint(bp); |
| 503 CHECK(!Debug::HasDebugInfo(shared)); | 507 CHECK(!Debug::HasDebugInfo(shared)); |
| 504 CHECK(Debug::EnsureDebugInfo(shared)); | 508 CHECK(Debug::EnsureDebugInfo(shared)); |
| 505 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); | 509 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); |
| 506 it2.FindBreakLocationFromPosition(position); | 510 it2.FindBreakLocationFromPosition(position); |
| 507 CHECK_EQ(mode, it2.it()->rinfo()->rmode()); | 511 actual_mode = it2.it()->rinfo()->rmode(); |
| 512 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) { |
| 513 actual_mode = v8::internal::RelocInfo::CODE_TARGET; |
| 514 } |
| 515 CHECK_EQ(mode, actual_mode); |
| 508 if (mode == v8::internal::RelocInfo::JS_RETURN) { | 516 if (mode == v8::internal::RelocInfo::JS_RETURN) { |
| 509 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); | 517 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); |
| 510 } | 518 } |
| 511 } | 519 } |
| 512 | 520 |
| 513 | 521 |
| 514 // --- D e b u g E v e n t H a n d l e r s | 522 // --- D e b u g E v e n t H a n d l e r s |
| 515 // --- | 523 // --- |
| 516 // --- The different tests uses a number of debug event handlers. | 524 // --- The different tests uses a number of debug event handlers. |
| 517 // --- | 525 // --- |
| (...skipping 6666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7184 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); | 7192 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); |
| 7185 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); | 7193 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); |
| 7186 | 7194 |
| 7187 // Get rid of the debug event listener. | 7195 // Get rid of the debug event listener. |
| 7188 v8::Debug::SetDebugEventListener(NULL); | 7196 v8::Debug::SetDebugEventListener(NULL); |
| 7189 CheckDebuggerUnloaded(); | 7197 CheckDebuggerUnloaded(); |
| 7190 } | 7198 } |
| 7191 | 7199 |
| 7192 | 7200 |
| 7193 #endif // ENABLE_DEBUGGER_SUPPORT | 7201 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |