| 550 | } |
| 551 | |
| 552 | void DebuggerTestBase::testBreakpointsOnNoOpLines() |
| 553 | { |
| 554 | auto* const session = createTestDebugSession(); |
| 555 | TestLaunchConfiguration cfg; |
| 556 | |
| 557 | const auto* const licenseBreakpoint = addDebugeeBreakpoint(9); |
| 558 | const auto* const blankLineBreakpoint = addDebugeeBreakpoint(34); |
| 559 | const auto* const lastLineBreakpoint = addDebugeeBreakpoint(42); |
| 560 | |
| 561 | ActiveStateSessionSpy sessionSpy(session); |
| 562 | START_DEBUGGING_AND_WAIT_FOR_PAUSED_STATE_E(session, cfg, sessionSpy); |
| 563 | |
| 564 | const auto debuggerMovesBreakpointFromLicenseNotice = currentMiLine(session) == 20; |
| 565 | |
| 566 | if (debuggerMovesBreakpointFromLicenseNotice) { |
| 567 | // The lines 9-19 consist of no-op code, so GDB versions older than 16 |
| 568 | // move the breakpoint from line 9 to line 20. The contents |
| 569 | // of the line 20 is "void noop() {}", so GDB stops at it 4 times (4 is the number of calls to noop()). |
| 570 | for (int noopCall = 0; noopCall < 4; ++noopCall) { |
| 571 | QCOMPARE(currentMiLine(session), 20); |
| 572 | CONTINUE_AND_WAIT_FOR_PAUSED_STATE(session, sessionSpy); |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | // The lines 34 and 35 consist of no-op code, so a debugger moves |
| 577 | // the breakpoint from line 34 to line 36 and stops at it. |
| 578 | QCOMPARE(currentMiLine(session), 36); |
| 579 | |
| 580 | if (debuggerMovesBreakpointFromLicenseNotice) { |
| 581 | QCOMPARE(breakpointMiLine(licenseBreakpoint), 20); |
| 582 | QCOMPARE(licenseBreakpoint->state(), Breakpoint::CleanState); |
| 583 | } else { |
| 584 | // GDB since version 16 and LLDB do not move the breakpoint from |
| 585 | // the no-op line 9 and permanently keep it in the pending state. |
| 586 | QCOMPARE(breakpointMiLine(licenseBreakpoint), 9); |
| 587 | QCOMPARE(licenseBreakpoint->state(), Breakpoint::PendingState); |
| 588 | } |
| 589 | |
| 590 | QCOMPARE(breakpointMiLine(blankLineBreakpoint), 36); |
| 591 | QCOMPARE(blankLineBreakpoint->state(), Breakpoint::CleanState); |
| 592 | |
| 593 | // A debugger does not move the breakpoint from the last no-op line 42 |
| 594 | // and permanently keeps it in the pending state. |
| 595 | QCOMPARE(breakpointMiLine(lastLineBreakpoint), 42); |
| 596 | QCOMPARE(lastLineBreakpoint->state(), Breakpoint::PendingState); |
| 597 | |
| 598 | session->run(); |
| 599 | WAIT_FOR_STATE(session, IDebugSession::EndedState); |
| 600 | } |
| 601 | |
| 602 | void DebuggerTestBase::testIgnoreHitsBreakpoint() |
| 603 | { |
nothing calls this directly
no test coverage detected