1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-14 11:45:38 +02:00

Bug 535014 - cannot debug in a container

- add check for network ports coming back empty for a Container
  launch and if so, fall-back to use the ip address of the Container
  for the remote host

Change-Id: I83d68a10e2dc92f7d0f27bb9dec304388594b4a3
This commit is contained in:
Jeff Johnston 2018-05-23 19:15:17 -04:00
parent d5b2f61dd7
commit 4c50b40f53

View file

@ -392,21 +392,20 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
wc.setAttribute( wc.setAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
Map<String, List<IDockerPortBinding>> hostPorts = new HashMap<>();
if (job.getPorts() != null && isLocalConnection) { if (job.getPorts() != null && isLocalConnection) {
Map<String, List<IDockerPortBinding>> hostPorts = job hostPorts = job.getPorts();
.getPorts(); }
List<IDockerPortBinding> bindingList = hostPorts List<IDockerPortBinding> bindingList = hostPorts
.get(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$ .get(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$
if (bindingList != null && !bindingList.isEmpty()) { if (bindingList != null && !bindingList.isEmpty()) {
IDockerPortBinding firstBinding = bindingList IDockerPortBinding firstBinding = bindingList.get(0);
.get(0);
wc.setAttribute( wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_HOST, IGDBLaunchConfigurationConstants.ATTR_HOST,
"localhost"); //$NON-NLS-1$ "localhost"); //$NON-NLS-1$
wc.setAttribute( wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_PORT, IGDBLaunchConfigurationConstants.ATTR_PORT,
firstBinding.hostPort()); firstBinding.hostPort());
}
} else { } else {
wc.setAttribute( wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_HOST, IGDBLaunchConfigurationConstants.ATTR_HOST,