Skip to content

Commit

Permalink
Allows launch config to override launch target connection type
Browse files Browse the repository at this point in the history
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
  • Loading branch information
betamaxbandit committed Nov 21, 2023
1 parent ddc8470 commit 44f17a1
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,16 +439,19 @@ public void completeInitialization(final RequestMonitor rm) {
}

// 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));
}
}
}
}
Expand Down Expand Up @@ -689,7 +692,7 @@ protected void doRegisterStep(final RequestMonitor requestMonitor) {
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();
}
Expand Down

0 comments on commit 44f17a1

Please sign in to comment.