| 1261 | } |
| 1262 | |
| 1263 | void DebuggerTestBase::testShowStepInSource() |
| 1264 | { |
| 1265 | auto* const session = createTestDebugSession(); |
| 1266 | TestLaunchConfiguration cfg; |
| 1267 | |
| 1268 | const QSignalSpy showStepInSourceSpy(session, &IDebugSession::showStepInSource); |
| 1269 | |
| 1270 | constexpr auto breakpointLine = 30; |
| 1271 | addDebugeeBreakpoint(breakpointLine); |
| 1272 | |
| 1273 | VERIFY_INVALID_CURRENT_LOCATION(session); |
| 1274 | ActiveStateSessionSpy sessionSpy(session); |
| 1275 | START_DEBUGGING_AND_WAIT_FOR_PAUSED_STATE_E(session, cfg, sessionSpy); |
| 1276 | VERIFY_VALID_CURRENT_LOCATION(session, debugeeUrl(), breakpointLine); |
| 1277 | |
| 1278 | STEP_INTO_AND_WAIT_FOR_PAUSED_STATE(session, sessionSpy); |
| 1279 | constexpr auto firstStepIntoLine = 23; |
| 1280 | VERIFY_VALID_CURRENT_LOCATION(session, debugeeUrl(), firstStepIntoLine); |
| 1281 | |
| 1282 | STEP_INTO_AND_WAIT_FOR_PAUSED_STATE(session, sessionSpy); |
| 1283 | constexpr auto secondStepIntoLine = 24; |
| 1284 | VERIFY_VALID_CURRENT_LOCATION(session, debugeeUrl(), secondStepIntoLine); |
| 1285 | |
| 1286 | session->run(); |
| 1287 | WAIT_FOR_STATE(session, IDebugSession::EndedState); |
| 1288 | |
| 1289 | const auto verifyArgumentsOfShowStepInSource = [this](const QVariantList& arguments, int miLine) { |
| 1290 | QCOMPARE(arguments.size(), 3); |
| 1291 | QCOMPARE(arguments.at(0).toUrl(), debugeeUrl()); |
| 1292 | // an MI line is one-based and IDebugSession::currentLine() is zero-based |
| 1293 | QCOMPARE(arguments.at(1).toInt(), miLine - 1); |
| 1294 | VERIFY_VALID_ADDRESS(arguments.at(2).toString()); |
| 1295 | }; |
| 1296 | |
| 1297 | QCOMPARE(showStepInSourceSpy.count(), 3); |
| 1298 | verifyArgumentsOfShowStepInSource(showStepInSourceSpy.at(0), breakpointLine); |
| 1299 | RETURN_IF_TEST_FAILED(); |
| 1300 | verifyArgumentsOfShowStepInSource(showStepInSourceSpy.at(1), firstStepIntoLine); |
| 1301 | RETURN_IF_TEST_FAILED(); |
| 1302 | verifyArgumentsOfShowStepInSource(showStepInSourceSpy.at(2), secondStepIntoLine); |
| 1303 | RETURN_IF_TEST_FAILED(); |
| 1304 | } |
| 1305 | |
| 1306 | void DebuggerTestBase::testStack() |
| 1307 | { |