Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-05-21 08:29:24 -0400
committerUwe Stieber2015-05-21 08:29:24 -0400
commitda777d74317b0cb192239474c4a6e9d8a026969a (patch)
treea93b26cb9f54b060eb6ff5f254b3a0c57b625719
parent77d2fc8a4c8e3474421f7bd4efef515454ba7367 (diff)
downloadorg.eclipse.tcf-da777d74317b0cb192239474c4a6e9d8a026969a.tar.gz
org.eclipse.tcf-da777d74317b0cb192239474c4a6e9d8a026969a.tar.xz
org.eclipse.tcf-da777d74317b0cb192239474c4a6e9d8a026969a.zip
Target Explorer: Adjust gdbserver launch for attaching to an remote application
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties4
3 files changed, 26 insertions, 11 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java
index f82be10d5..a7f003ad9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java
@@ -75,19 +75,29 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate {
// Get the peer from the launch configuration
IPeer peer = TEHelper.getCurrentConnection(config).getPeer();
+ // Determine if the launch is an attach launch
+ final boolean isAttachLaunch = ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH.equals(config.getType().getIdentifier());
+
// Get the executable path (run/debug application) or the PID (attach to application)
IPath exePath = checkBinaryDetails(config);
- String remoteExePath = null;
+ String remoteExePath = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_REMOTE_PATH, (String)null);
String remotePID = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_REMOTE_PID, (String)null);
- // If neither executable not PID is given --> abort
- if (exePath == null && remotePID == null) {
- abort(Messages.TEGdbAbstractLaunchDelegate_no_program_or_pid, null, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+ // Not an attach launch and the executable is not specified --> abort
+ if (!isAttachLaunch && exePath == null) {
+ abort(Messages.TEGdbAbstractLaunchDelegate_no_program, null, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+ }
+ // Not an attach launch and the remote executable is not specified --> abort
+ if (!isAttachLaunch && remoteExePath == null) {
+ abort(Messages.TEGdbAbstractLaunchDelegate_no_remote_path, null, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+ }
+ // Attach launch and the remote PID is not specified --> abort
+ if (isAttachLaunch && remotePID == null) {
+ abort(Messages.TEGdbAbstractLaunchDelegate_no_pid, null, ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID);
}
// If an executable path is specified, download the binary if needed
- if (exePath != null) {
- remoteExePath = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_REMOTE_PATH, ""); //$NON-NLS-1$
+ if (!isAttachLaunch && exePath != null && remoteExePath != null) {
monitor.setTaskName(Messages.TEGdbAbstractLaunchDelegate_downloading);
boolean skipDownload = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false);
@@ -101,15 +111,16 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate {
}
}
- // 2.Launch gdbserver on target
+ // Launch gdbserver on target
String gdbserverPortNumber = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT, IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
String gdbserverPortNumberMappedTo = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_PORT_MAPPED_TO, (String) null);
String gdbserverCommand = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND, IRemoteTEConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
+
String commandArguments = ""; //$NON-NLS-1$
- if (remotePID != null && !"".equals(remotePID)) { //$NON-NLS-1$
+ if (isAttachLaunch) {
commandArguments = "--attach :" + gdbserverPortNumber + " " + remotePID; //$NON-NLS-1$ //$NON-NLS-2$
monitor.setTaskName(Messages.TEGdbAbstractLaunchDelegate_attaching_program);
- } else if (remoteExePath != null && !"".equals(remoteExePath)) { //$NON-NLS-1$
+ } else {
commandArguments = ":" + gdbserverPortNumber + " " + TEHelper.spaceEscapify(remoteExePath); //$NON-NLS-1$ //$NON-NLS-2$
String arguments = getProgramArguments(config);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java
index 168f00ee9..0ec250b3a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java
@@ -44,7 +44,9 @@ public class Messages extends NLS {
public static String TCFPeerSelector_0;
- public static String TEGdbAbstractLaunchDelegate_no_program_or_pid;
+ public static String TEGdbAbstractLaunchDelegate_no_program;
+ public static String TEGdbAbstractLaunchDelegate_no_remote_path;
+ public static String TEGdbAbstractLaunchDelegate_no_pid;
public static String TEGdbAbstractLaunchDelegate_downloading;
public static String TEGdbAbstractLaunchDelegate_attaching_program;
public static String TEGdbAbstractLaunchDelegate_starting_program;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties
index 7d5cd7b16..71fc685ff 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties
@@ -37,7 +37,9 @@ Port_number_mapped_to_textfield_label=Mapped to:
TEHelper_executing=Executing {0} {1}
TEHelper_connection_not_found=Could not find the remote connection.
-TEGdbAbstractLaunchDelegate_no_program_or_pid=Either the application path or the PID to attach to must be specified.
+TEGdbAbstractLaunchDelegate_no_program=The application path must be specified.
+TEGdbAbstractLaunchDelegate_no_remote_path=The remote application path must be specified.
+TEGdbAbstractLaunchDelegate_no_pid=The application PID must be specified.
TEGdbAbstractLaunchDelegate_downloading=Downloading
TEGdbAbstractLaunchDelegate_attaching_program=Attaching to Application
TEGdbAbstractLaunchDelegate_starting_program=Starting Application

Back to the top