Bug 547881 - Allow targets to set ATTR_REMOTE_TCP

Adds support for this attribute in the ILaunchTarget attributes and
then convert it to the boolean attribute on the launch config.

Change-Id: Ieefa6892641517ff0fa6a0a04f63a6a8dbc35bf4
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
index d1ce72b..98e43c9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
@@ -551,8 +551,13 @@
 				ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
 				if (target != null) {
 					attributes.putAll(target.getAttributes());
-					attributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
-							target.getTypeId().equals(GDBRemoteTCPLaunchTargetProvider.TYPE_ID));
+					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));
+					}
 				}
 			}
 
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java
index 590e71b..16c45b0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java
@@ -443,8 +443,13 @@
 			ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
 			if (target != null) {
 				attributes.putAll(target.getAttributes());
-				attributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
-						target.getTypeId().equals(GDBRemoteTCPLaunchTargetProvider.TYPE_ID));
+				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));
+				}
 			}
 		}