| 1441 | |
| 1442 | template <typename TCommandRegister> |
| 1443 | void DebuggerPlugin::registerCommands( TCommandRegister* executer ) { |
| 1444 | registerCommand( executer, "debugger-continue-interrupt", [this] { |
| 1445 | if ( mDebugger && mListener ) { |
| 1446 | if ( mListener->isStopped() ) { |
| 1447 | resume( mListener->getCurrentThreadId() ); |
| 1448 | } else { |
| 1449 | mDebugger->pause( 1 ); |
| 1450 | } |
| 1451 | } else { |
| 1452 | auto pbm = getPluginContext()->getProjectBuildManager(); |
| 1453 | if ( !pbm ) |
| 1454 | return; |
| 1455 | if ( !pbm->hasBuildConfigWithBuildSteps() ) { |
| 1456 | runCurrentConfig(); |
| 1457 | return; |
| 1458 | } |
| 1459 | pbm->buildCurrentConfig( |
| 1460 | getPluginContext()->getStatusBuildOutputController(), [this]( int exitCode ) { |
| 1461 | if ( exitCode == 0 ) { |
| 1462 | runCurrentConfig(); |
| 1463 | } else { |
| 1464 | getPluginContext()->getUISceneNode()->runOnMainThread( [this] { |
| 1465 | auto msgBox = UIMessageBox::New( |
| 1466 | UIMessageBox::YES_NO, |
| 1467 | i18n( "build_failed_debug_anyways", |
| 1468 | "Building the project failed, do you want to " |
| 1469 | "debug the binary anyways?" ) ); |
| 1470 | msgBox->setTitle( i18n( "build_failed", "Build Failed" ) ); |
| 1471 | msgBox->setCloseShortcut( { KEY_ESCAPE, KEYMOD_NONE } ); |
| 1472 | msgBox->on( Event::OnConfirm, [this]( auto ) { runCurrentConfig(); } ); |
| 1473 | msgBox->showWhenReady(); |
| 1474 | } ); |
| 1475 | } |
| 1476 | } ); |
| 1477 | } |
| 1478 | } ); |
| 1479 | |
| 1480 | registerCommand( executer, "debugger-start", [this] { |
| 1481 | if ( mDebugger ) |
| 1482 | exitDebugger( true ); |
| 1483 | runCurrentConfig(); |
| 1484 | } ); |
| 1485 | |
| 1486 | registerCommand( executer, "debugger-stop", [this] { exitDebugger( true ); } ); |
| 1487 | |
| 1488 | registerCommand( executer, "debugger-start-stop", [this] { |
| 1489 | if ( mDebugger && mDebugger->started() ) { |
| 1490 | exitDebugger( true ); |
| 1491 | } else { |
| 1492 | runCurrentConfig(); |
| 1493 | } |
| 1494 | } ); |
| 1495 | |
| 1496 | registerCommand( executer, "debugger-step-over", [this] { |
| 1497 | if ( mDebugger && mListener && mListener->isStopped() ) |
| 1498 | mDebugger->stepOver( mListener->getCurrentThreadId() ); |
| 1499 | } ); |
| 1500 |
nothing calls this directly
no test coverage detected