Improve attach to "Run Target". Now it's possible to debug a terminal application by using this attach.

This commit is contained in:
Martín Lucas Golini
2025-02-05 02:08:31 -03:00
parent eae433796e
commit 72c1d9fd3f
7 changed files with 29 additions and 18 deletions

View File

@@ -419,6 +419,7 @@ void DebuggerPlugin::loadDAPConfig( const std::string& path, bool updateConfigFi
dapConfig.name = config.value( "name", "" );
if ( !dapConfig.name.empty() ) {
dapConfig.request = config.value( "request", REQUEST_TYPE_LAUNCH );
dapConfig.runTarget = config.value( "runTarget", false );
dapConfig.args = config["arguments"];
}
if ( config.contains( "command_arguments" ) ) {
@@ -1736,6 +1737,7 @@ void DebuggerPlugin::prepareAndRun( DapTool debugger, DapConfig config,
int randomPort = Math::randi( 44000, 45000 );
ProtocolSettings protocolSettings;
protocolSettings.launchRequestType = config.request;
protocolSettings.runTarget = config.runTarget;
auto args = config.args;
replaceKeysInJson( args, randomPort, solvedInputs );
protocolSettings.launchArgs = args;
@@ -2027,6 +2029,11 @@ void DebuggerPlugin::run( const std::string& debugger, ProtocolSettings&& protoc
} );
};
dap->runTargetCb = [this] {
getUISceneNode()->runOnMainThread(
[this] { getPluginContext()->runCommand( "project-run-executable" ); } );
};
mDebugger->start();
}