1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 19:25: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(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
Map<String, List<IDockerPortBinding>> hostPorts = new HashMap<>();
if (job.getPorts() != null && isLocalConnection) {
Map<String, List<IDockerPortBinding>> hostPorts = job
.getPorts();
hostPorts = job.getPorts();
}
List<IDockerPortBinding> bindingList = hostPorts
.get(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$
if (bindingList != null && !bindingList.isEmpty()) {
IDockerPortBinding firstBinding = bindingList
.get(0);
IDockerPortBinding firstBinding = bindingList.get(0);
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_HOST,
"localhost"); //$NON-NLS-1$
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_PORT,
firstBinding.hostPort());
}
} else {
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_HOST,