Skip to content

Conversation

ewaterlander
Copy link
Contributor

Support the Gdb Remote TCP and Serial launch targets for CoreBuild projects. A new non-public LaunchConfiguration type is added, that is working with the same launch descriptor type as CoreBuild Local projects. Also a new LaunchConfigurationProvider that supports the Gdb Remote TCP and Serial targets is added.

It makes use of the launch delegate
org.eclipse.cdt.dsf.gdb.launching.GdbTargetedLaunchDelegate, which is also used for standard GDB (DSF) Manual Remote Debugging launch configurations for TCP and Serial connections.

For the user is appears as if there is a single CoreBuild launch configuration that adapts dynamically to the launch target, while in reality there is a separate launch configuration for each target.

Fixes #1168

@ewaterlander
Copy link
Contributor Author

Hi @betamaxbandit and @Kummallinen
would you like to review this?

CoreBuildGdbManualRemoteLaunchConfigProvider is at the moment a modified copy of the provider for Local. It needs further cleanup which I would like to discuss about.

With this change we will have working Gdb Remote launch targets for CMake and CoreBuild Makefile projects.


@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
// TODO Auto-generated method stub
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D: remove comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


@Override
public void launchTargetRemoved(ILaunchTarget target) throws CoreException {
// TODO Auto-generated method stub
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O: if you're sure there is nothing to do then say it in a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the method.

* E.g. org.eclipse.cdt.debug.core.launch.CoreBuildGenericLaunchConfigProvider.
*/

public class CoreBuildGdbManualRemoteLaunchConfigProvider extends AbstractLaunchConfigProvider {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O: hmm, my experience of writing launch config providers for Renesas is to use ProjectPerTargetLaunchConfigProvider.
With that approach, it is expected that any values in the launch target (eg hostname, port) are copied from the launch target into the launch configuration during populateLaunchConfiguration.

Additionally we have a unique launch configuration per launch target, so in createLaunchConfiguration the name also contains the launch target ID, like this:

	 /*
	 * Suffix the launch configuration with the launch target name, so its obvious to the user which one they are
	 * using.
	 */
	String name = launchManager.generateLaunchConfigurationName(descriptor.getName()//
			+ " " + target.getId());

When the user changes the launch target, the corresponding launch configuration is available when clicking the launchbar launch config gear. And any previously set values are shown.

Without this, I don't see the purpose of the launch target.

In this scenario, Renesas launch targets specify a target device. So maybe this approach is not appropriate when we're talking about a TCP/Serial connection.

This way of thinking for me may be so ingrained now that it's difficult for me to see any other way. Can you share your vision for this please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @betamaxbandit

I updated my code. The launch config name is now unique and target attributes are populated into the configuration.

I did not know of ProjectPerTargetLaunchConfigProvider. It is not used in CDT, except in one test.
I will look into it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it is not critical to use ProjectPerTargetLaunchConfigProvider.
However, it does provide a getLaunch and getLaunchDescriptor method which might be useful.
Also another use of using ProjectPerTargetLaunchConfigProvider is it can be tested for using instanceof. I think this can be useful in launch classes to distinguish between a corebuild and non-corebuild launch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment a unique launch configuration is made every time the connection settings change. E.g. for a TCP target, if I change only the port number a new launch configuration is created. This means I have to re-enter in all the non Debugger tabs all non-default settings. This is perhaps a bit too much uniqueness.

Perhaps just the name of the launch target is enough.

Copy link
Contributor

@betamaxbandit betamaxbandit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ewaterlander ,
this looks good to me. The only minor is the extension point comment.
Some of the checks are failing - I haven't investigated those.
The other comments I've made need some more thought and probably in a future commit.

It would be good to have a manual test for this, so that at least the typical expected user flow is known and documented.

@@ -123,4 +140,13 @@
</enablement>
</configProvider>
</extension>
<extension
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O: this extension point could be merged with the one above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return workingCopy.doSave();
}

private String getTargetConfigKey(ILaunchTarget target) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this method and the one in CoreBuildGenericLaunchConfigProvider

* E.g. org.eclipse.cdt.debug.core.launch.CoreBuildGenericLaunchConfigProvider.
*/

public class CoreBuildGdbManualRemoteLaunchConfigProvider extends AbstractLaunchConfigProvider {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it is not critical to use ProjectPerTargetLaunchConfigProvider.
However, it does provide a getLaunch and getLaunchDescriptor method which might be useful.
Also another use of using ProjectPerTargetLaunchConfigProvider is it can be tested for using instanceof. I think this can be useful in launch classes to distinguish between a corebuild and non-corebuild launch.

Comment on lines +138 to +152
String targetTypeId = target.getTypeId();
if (targetTypeId.equals(GDBRemoteTCPLaunchTargetProvider.TYPE_ID)) {
String host = target.getAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, EMPTY);
String port = target.getAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, EMPTY);
workingCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
workingCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, host);
workingCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, port);
}
if (targetTypeId.equals(GDBRemoteSerialLaunchTargetProvider.TYPE_ID)) {
String serialPort = target.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, EMPTY);
String baudRate = target.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, EMPTY);
workingCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, false);
workingCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, serialPort);
workingCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, baudRate);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see you are copying the values from the launch target to the launch config here.

If the user subsequently changes the values in the launch target, they are not be updated in the launch configuration. More thought is needed to handle this, maybe in another commit...

Perhaps there should be a new ILaunchConfigurationProvider2 added, which has launchTargetChanged. I'm just thinking aloud here. Maybe this is called in 2 places:

  • When the launch config is opened again.
  • During a launch, which allows the launch config to be synchronised with the launch target.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also related to this comment is another issue.

image

The Type control and other controls for TCP and Serial should be disabled when using a targetted launch, because now these values can be specified in 2 places; the launch target and the launch config. Which one takes precedence? I think the launch target values should. Therefore the user should not be aloud to change them in the launch config.

Maybe to assist the user when the controls are greyed out, there should be a helpful hint to change them in the launch target, in a tooltip or message somewhere

When using a non-targetted launch (ie the regular Debug Configurations dialog with delegate C/C++ Remote Applications using "GDB (DSF) Manual Remote Debugging Launcher"), the controls should be enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A launch target can be used for multiple launch configurations. You would have to keep all of them in sync.

Core Build launch configurations are not public, they can only be launched from the launch bar, not from the regular Debug Configurations dialog. The launch target values take precedence over the launch configuration values. The controls and fields can be greyed out as you suggested, when the launch configuration of Core Build type. Editing does not make sense, because it will always be overruled by the launch target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a commit that disables the fields in the launch configuration when the type is Core Build GDB Remote.

Support the Gdb Remote TCP and Serial launch targets for CoreBuild
projects.  A new non-public LaunchConfiguration type is added, that is
working with the same launch descriptor type as CoreBuild Local
projects. Also a new LaunchConfigurationProvider that supports the Gdb
Remote TCP and Serial targets is added.

It makes use of the launch delegate
org.eclipse.cdt.dsf.gdb.launching.GdbTargetedLaunchDelegate, which is
also used for standard GDB (DSF) Manual Remote Debugging launch
configurations for TCP and Serial connections.

For the user is appears as if there is a single CoreBuild launch
configuration that adapts dynamically to the launch target, while in
reality there is a separate launch configuration for each target.

Also cleanup up a bit CoreBuildGenericLaunchConfigProvider and
fixed a bug in launchTargetRemoved().

Fixes eclipse-cdt#1168
@ewaterlander ewaterlander force-pushed the gdb_remote_target branch 2 times, most recently from 81b77e9 to aa54039 Compare August 21, 2025 11:43
Launch Target settings have precedence over Launch Configuration
settings. Multiple Launch Configurations can use the same Launch
Target. Disable settings controlled by the Launch Target to avoid
inconsistent settings.

For non-CoreBuild GDB remote launch configurations the settings remain
editable.  These launch configurations can be launched without launch
bar.
@ewaterlander
Copy link
Contributor Author

I'm going to add documentation too.

@ewaterlander
Copy link
Contributor Author

Hi @betamaxbandit , would you like to review my last commit "New launch configuration name based on target name."

@betamaxbandit
Copy link
Contributor

Hi @betamaxbandit , would you like to review my last commit "New launch configuration name based on target name."

Hey @ewaterlander , nice1 for the update. I'll review it soon.

The new launch configuration name is only based on the target name and
the type (tcp or serial).
Changing a connection parameter will not result in a new launch
configuration.
Copy link

github-actions bot commented Sep 3, 2025

Test Results

   636 files     636 suites   35m 34s ⏱️
11 440 tests 11 295 ✅ 144 💤 1 ❌
11 439 runs  11 296 ✅ 142 💤 1 ❌

For more details on these failures, see this check.

Results for commit f14f4a4.

@ewaterlander
Copy link
Contributor Author

License check is failing because ClearlyDefined servers are offline.
One failing test. Looks unrelated to me.
I try again later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gdb Remote launch targets for CoreBuild projects
2 participants