1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Allows launch config to override launch target connection type (#625)

When launching a GDB debug session using the Launch Bar and a Launch
Target, now the launch takes into account a REMOTE_TCP value in the
launch configuration before considering the type of the Launch Target.

Improves the change submitted in:
Bug 547881 - Allow targets to set ATTR_REMOTE_TCP

Fixes issue #622
This commit is contained in:
betamax 2023-12-27 23:42:00 +00:00 committed by GitHub
parent 93c136de3c
commit 959c02755c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
Bundle-Version: 7.1.200.qualifier
Bundle-Version: 7.1.300.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -439,16 +439,19 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
}
// And optionally the target
if (launch instanceof ITargetedLaunch) {
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
if (launch instanceof ITargetedLaunch targettedLaunch) {
ILaunchTarget target = targettedLaunch.getLaunchTarget();
if (target != null) {
attributes.putAll(target.getAttributes());
String tcp = target.getAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, ""); //$NON-NLS-1$
if (!tcp.isEmpty()) {
attributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, Boolean.parseBoolean(tcp));
} else {
attributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
target.getTypeId().equals(GDBRemoteTCPLaunchTargetProvider.TYPE_ID));
// If the launch config attrs don't contain a REMOTE_TCP value then check the launch target attrs
if (!attributes.containsKey(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP)) {
attributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
target.getTypeId().equals(GDBRemoteTCPLaunchTargetProvider.TYPE_ID));
}
}
}
}
@ -689,7 +692,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
getSession().addServiceEventListener(GDBControl.this, null);
register(new String[] { ICommandControl.class.getName(), ICommandControlService.class.getName(),
IMICommandControl.class.getName(), AbstractMIControl.class.getName(), IGDBControl.class.getName() },
new Hashtable<String, String>());
new Hashtable<>());
getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties());
requestMonitor.done();
}