aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/windows-nat.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2ccc5d7..0a5e79c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-24 Joel Brobecker <brobecker@adacore.com>
+
+ * windows-nat.c (windows_create_inferior) [!__CYGWIN__]:
+ New local variable args_len.
+ Quote the name of the executable when computing the command line.
+
2012-10-23 Mark Kettenis <kettenis@gnu.org>
PR gdb/12796
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 905d4bf..5eb8f67 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2036,6 +2036,7 @@ windows_create_inferior (struct target_ops *ops, char *exec_file,
char shell[__PMAX]; /* Path to shell */
char *toexec;
char *args;
+ size_t args_len;
HANDLE tty;
char *w32env;
char *temp;
@@ -2188,10 +2189,13 @@ windows_create_inferior (struct target_ops *ops, char *exec_file,
}
#else
toexec = exec_file;
- args = alloca (strlen (toexec) + strlen (allargs) + 2);
- strcpy (args, toexec);
- strcat (args, " ");
- strcat (args, allargs);
+ /* Build the command line, a space-separated list of tokens where
+ the first token is the name of the module to be executed.
+ To avoid ambiguities introduced by spaces in the module name,
+ we quote it. */
+ args_len = strlen (toexec) + 2 /* quotes */ + strlen (allargs) + 2;
+ args = alloca (args_len);
+ xsnprintf (args, args_len, "\"%s\" %s", toexec, allargs);
flags |= DEBUG_ONLY_THIS_PROCESS;