Skip to content

Commit a5d5959

Browse files
authored
Gdb Manual Remote launch targets for CoreBuild projects (#1222)
* Gdb Manual Remote launch targets for CoreBuild projects 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(). * Disable the GDB connection fields for CoreBuild launch configurations. 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. * Documentation Core Build debug remote target. * New launch configuration name based on target name. 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. Fixes #1168
1 parent 5e840bf commit a5d5959

35 files changed

Lines changed: 664 additions & 110 deletions

debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true
5-
Bundle-Version: 9.0.200.qualifier
5+
Bundle-Version: 9.0.300.qualifier
66
Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigProvider.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2017 - 2025 QNX Software Systems and others.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*******************************************************************************/
111
package org.eclipse.cdt.debug.core.launch;
212

313
import java.util.HashMap;
@@ -42,6 +52,12 @@ public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor des
4252
.getLaunchConfigurationType(CoreBuildGenericLaunchConfigDelegate.TYPE_ID);
4353
}
4454

55+
private String getTargetConfigKey(ILaunchTarget target) {
56+
String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY);
57+
String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY);
58+
return os + '.' + arch;
59+
}
60+
4561
@Override
4662
public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target)
4763
throws CoreException {
@@ -54,10 +70,7 @@ public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor,
5470
configs.put(project, projectConfigs);
5571
}
5672

57-
String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY);
58-
String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY);
59-
String targetConfig = os + '.' + arch;
60-
config = projectConfigs.get(targetConfig);
73+
config = projectConfigs.get(getTargetConfigKey(target));
6174
if (config == null) {
6275
config = createLaunchConfiguration(descriptor, target);
6376
}
@@ -141,25 +154,20 @@ public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreExc
141154
@Override
142155
public void launchTargetRemoved(ILaunchTarget target) throws CoreException {
143156
// Any other targets have the same OS and ARCH?
144-
String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY);
145-
String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY);
146-
147157
ILaunchTargetManager targetManager = CDebugCorePlugin.getService(ILaunchTargetManager.class);
148158
for (ILaunchTarget t : targetManager.getLaunchTargets()) {
149-
if (!target.equals(t) && os.equals(t.getAttribute(ILaunchTarget.ATTR_OS, EMPTY))
150-
&& arch.equals(t.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY))) {
159+
if (!target.equals(t) && getTargetConfigKey(target).equals(getTargetConfigKey(t))) {
151160
// Yup, nothing to do then
152161
return;
153162
}
154163
}
155164

156165
for (Entry<IProject, Map<String, ILaunchConfiguration>> projectEntry : configs.entrySet()) {
157166
Map<String, ILaunchConfiguration> projectConfigs = projectEntry.getValue();
158-
ILaunchConfiguration config = projectConfigs.get(os);
167+
ILaunchConfiguration config = projectConfigs.get(getTargetConfigKey(target));
159168
if (config != null) {
160169
config.delete();
161170
}
162171
}
163172
}
164-
165173
}
57 KB
Loading
58.2 KB
Loading
60.2 KB
Loading
66.2 KB
Loading
80.5 KB
Loading
49 KB
Loading
51.6 KB
Loading

doc/org.eclipse.cdt.doc.user/src/getting_started/cbs_debug_project.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif::[]
2828
// adoc files.
2929
// ENDOFHEADER
3030

31-
== Debugging a project
31+
== Debugging a local target
3232

3333
Debugging a CBS project is done via the xref:cbs_launchbar.adoc[Launch Bar]. Make
3434
sure the launch bar is installed and enabled.
@@ -79,3 +79,5 @@ On the *Source* tab extra paths outside the project folder can be
7979
defined to look for source code.
8080

8181
image:cbs_launch_config_tab_debug.png[Launch configuration debug tab]
82+
83+
icon:arrow-circle-right[] xref:cbs_debug_remote.adoc[Next: Debugging a remote target]

0 commit comments

Comments
 (0)