| 1401 | } |
| 1402 | |
| 1403 | void DebuggerTestBase::testStackSwitchThread() |
| 1404 | { |
| 1405 | auto* const session = createTestDebugSession(); |
| 1406 | TestLaunchConfiguration cfg("debuggee_debugeethreads"); |
| 1407 | const auto fileName = findSourceFile("debugeethreads.cpp"); |
| 1408 | |
| 1409 | auto* const stackModel = session->frameStackModel(); |
| 1410 | |
| 1411 | breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile(fileName), 43); // QThread::msleep(600); |
| 1412 | const ActiveStateSessionSpy sessionSpy(session); |
| 1413 | START_DEBUGGING_AND_WAIT_FOR_PAUSED_STATE_E(session, cfg, sessionSpy); |
| 1414 | |
| 1415 | auto threadIndex = stackModel->index(0, 0); |
| 1416 | VALIDATE_COLUMN_COUNTS_THREAD_COUNT_AND_STACK_FRAME_NUMBERS(threadIndex, 4); |
| 1417 | COMPARE_DATA(threadIndex, "#1 at main"); |
| 1418 | COMPARE_ENTIRE_MAIN_THREAD_STACK_FRAME_COUNT(stackModel, threadIndex, 1); |
| 1419 | COMPARE_DATA(stackModel->index(0, 1, threadIndex), "main"); |
| 1420 | COMPARE_DATA(stackModel->index(0, 2, threadIndex), fileName + ":44"); // QThread::msleep(600); |
| 1421 | |
| 1422 | threadIndex = stackModel->index(1, 0); |
| 1423 | VALIDATE_COLUMN_COUNTS_THREAD_COUNT_AND_STACK_FRAME_NUMBERS(threadIndex, 4); |
| 1424 | QVERIFY(stackModel->data(threadIndex).toString().startsWith("#2 at ")); |
| 1425 | QCOMPARE(stackModel->rowCount(threadIndex), 0); // frames are not fetched for non-current threads |
| 1426 | |
| 1427 | stackModel->setCurrentThread(2); |
| 1428 | WAIT_FOR_STATE_AND_IDLE(session, IDebugSession::PausedState); |
| 1429 | |
| 1430 | VALIDATE_COLUMN_COUNTS_THREAD_COUNT_AND_STACK_FRAME_NUMBERS(threadIndex, 4); |
| 1431 | QVERIFY(stackModel->data(threadIndex).toString().startsWith("#2 at ")); |
| 1432 | QCOMPARE_GE(stackModel->rowCount(threadIndex), 4); |
| 1433 | |
| 1434 | session->run(); |
| 1435 | WAIT_FOR_STATE(session, IDebugSession::EndedState); |
| 1436 | } |
| 1437 | |
| 1438 | void DebuggerTestBase::testThreadAndFrameInfo() |
| 1439 | { |
nothing calls this directly
no test coverage detected