| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // Create function and set the break point. | 494 // Create function and set the break point. |
| 495 Handle<v8::internal::JSFunction> fun = v8::Utils::OpenHandle( | 495 Handle<v8::internal::JSFunction> fun = v8::Utils::OpenHandle( |
| 496 *CompileFunction(env, source, name)); | 496 *CompileFunction(env, source, name)); |
| 497 int bp = SetBreakPoint(fun, position); | 497 int bp = SetBreakPoint(fun, position); |
| 498 | 498 |
| 499 // Check that the debug break function is as expected. | 499 // Check that the debug break function is as expected. |
| 500 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared()); | 500 Handle<v8::internal::SharedFunctionInfo> shared(fun->shared()); |
| 501 CHECK(Debug::HasDebugInfo(shared)); | 501 CHECK(Debug::HasDebugInfo(shared)); |
| 502 TestBreakLocationIterator it1(Debug::GetDebugInfo(shared)); | 502 TestBreakLocationIterator it1(Debug::GetDebugInfo(shared)); |
| 503 it1.FindBreakLocationFromPosition(position); | 503 it1.FindBreakLocationFromPosition(position); |
| 504 v8::internal::RelocInfo::Mode actual_mode = it1.it()->rinfo()->rmode(); | 504 CHECK_EQ(mode, it1.it()->rinfo()->rmode()); |
| 505 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) { | |
| 506 actual_mode = v8::internal::RelocInfo::CODE_TARGET; | |
| 507 } | |
| 508 CHECK_EQ(mode, actual_mode); | |
| 509 if (mode != v8::internal::RelocInfo::JS_RETURN) { | 505 if (mode != v8::internal::RelocInfo::JS_RETURN) { |
| 510 CHECK_EQ(debug_break, | 506 CHECK_EQ(debug_break, |
| 511 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); | 507 Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); |
| 512 } else { | 508 } else { |
| 513 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo())); | 509 CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo())); |
| 514 } | 510 } |
| 515 | 511 |
| 516 // Clear the break point and check that the debug break function is no longer | 512 // Clear the break point and check that the debug break function is no longer |
| 517 // there | 513 // there |
| 518 ClearBreakPoint(bp); | 514 ClearBreakPoint(bp); |
| 519 CHECK(!debug->HasDebugInfo(shared)); | 515 CHECK(!debug->HasDebugInfo(shared)); |
| 520 CHECK(debug->EnsureDebugInfo(shared)); | 516 CHECK(debug->EnsureDebugInfo(shared)); |
| 521 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); | 517 TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); |
| 522 it2.FindBreakLocationFromPosition(position); | 518 it2.FindBreakLocationFromPosition(position); |
| 523 actual_mode = it2.it()->rinfo()->rmode(); | 519 CHECK_EQ(mode, it2.it()->rinfo()->rmode()); |
| 524 if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) { | |
| 525 actual_mode = v8::internal::RelocInfo::CODE_TARGET; | |
| 526 } | |
| 527 CHECK_EQ(mode, actual_mode); | |
| 528 if (mode == v8::internal::RelocInfo::JS_RETURN) { | 520 if (mode == v8::internal::RelocInfo::JS_RETURN) { |
| 529 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); | 521 CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); |
| 530 } | 522 } |
| 531 } | 523 } |
| 532 | 524 |
| 533 | 525 |
| 534 // --- D e b u g E v e n t H a n d l e r s | 526 // --- D e b u g E v e n t H a n d l e r s |
| 535 // --- | 527 // --- |
| 536 // --- The different tests uses a number of debug event handlers. | 528 // --- The different tests uses a number of debug event handlers. |
| 537 // --- | 529 // --- |
| (...skipping 6723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7261 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); | 7253 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); |
| 7262 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); | 7254 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); |
| 7263 | 7255 |
| 7264 // Get rid of the debug event listener. | 7256 // Get rid of the debug event listener. |
| 7265 v8::Debug::SetDebugEventListener(NULL); | 7257 v8::Debug::SetDebugEventListener(NULL); |
| 7266 CheckDebuggerUnloaded(); | 7258 CheckDebuggerUnloaded(); |
| 7267 } | 7259 } |
| 7268 | 7260 |
| 7269 | 7261 |
| 7270 #endif // ENABLE_DEBUGGER_SUPPORT | 7262 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |