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