Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dumais2017-01-23 17:57:02 +0000
committerGerrit Code Review @ Eclipse.org2017-02-07 14:48:23 +0000
commit7f6e7f8c9b5785a2e219d1fb030a3a197bedb665 (patch)
tree1a4b0be413fd37fe816ef22414ef21a077c07abf /launch/org.eclipse.cdt.docker.launcher
parentff23fc9dbec21bd99440c205dfa8a95a435d89b0 (diff)
downloadorg.eclipse.cdt-7f6e7f8c9b5785a2e219d1fb030a3a197bedb665.tar.gz
org.eclipse.cdt-7f6e7f8c9b5785a2e219d1fb030a3a197bedb665.tar.xz
org.eclipse.cdt-7f6e7f8c9b5785a2e219d1fb030a3a197bedb665.zip
Bug 510615 - Launch dialog, handle spaces in gdb path
The path to GDB is set in the launch dialog, under the Debugger tab. If the path to GDB contains one or more spaces, and is not within double quotes, GDB will not be found and the launch will fail. This patch improves the use cases around the "Browse" button, to select GDB's path. 1) if the user clicks on the "Browse" button, the browse dialog will open in the correct place, no matter the presence of space(s). 2) When GDB's path is selected with the "Browse" button, it's then set in the "GDB debugger" field. This patch looks at the selected path and adds surrounding double quotes if there is any space within, and strips any double quotes if there are no spaces. Change-Id: I202f574772965af3a491d449b9e9a97e8c61e2b0
Diffstat (limited to 'launch/org.eclipse.cdt.docker.launcher')
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java
index 01ad626dfaa..073ba62effb 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java
@@ -347,13 +347,21 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
String gdbCommand = fGDBCommandText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
- dialog.setFilterPath(
- gdbCommand.substring(0, lastSeparatorIndex));
+ String cmd = gdbCommand.substring(0, lastSeparatorIndex);
+ // remove double quotes, since they interfere with
+ // "setFilterPath()" below
+ cmd = cmd.replaceAll("\\\"", ""); //$NON-NLS-1$//$NON-NLS-2$
+ dialog.setFilterPath(cmd);
}
String res = dialog.open();
if (res == null) {
return;
}
+ // path contains space(s)?
+ if (res.contains(" ")) { //$NON-NLS-1$
+ // surround it in double quotes
+ res = '"' + res + '"';
+ }
fGDBCommandText.setText(res);
}
});

Back to the top