diff options
author | Eli Zaretskii <eliz@gnu.org> | 2001-07-15 10:28:13 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2001-07-15 10:28:13 +0000 |
commit | 150985e3a1738a7781371d98ab5a0be9f46148de (patch) | |
tree | b20ed571015978006f8806bd86fcfb3f6c6c53c2 /gdb | |
parent | 96fe9e8c46b260068c06a81f92b9272ca067df40 (diff) | |
download | gdb-150985e3a1738a7781371d98ab5a0be9f46148de.zip gdb-150985e3a1738a7781371d98ab5a0be9f46148de.tar.gz gdb-150985e3a1738a7781371d98ab5a0be9f46148de.tar.bz2 |
* go32-nat.c (go32_create_inferior): Support command lines longer
than 126 characters.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/go32-nat.c | 22 |
2 files changed, 24 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e463709..dc744d5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2001-07-15 Eli Zaretskii <eliz@is.elta.co.il> + + * go32-nat.c (go32_create_inferior): Support command lines longer + than 126 characters. + 2001-07-14 Stephane Carrez <Stephane.Carrez@worldnet.fr> * NEWS: New target 68HC11/68HC12. diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index c9d02d1..56ab8cb 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -588,6 +588,7 @@ go32_create_inferior (char *exec_file, char *args, char **env) jmp_buf start_state; char *cmdline; char **env_save = environ; + size_t cmdlen; /* If no exec file handed to us, get it from the exec-file command -- with a good, common error message if none is specified. */ @@ -622,10 +623,24 @@ go32_create_inferior (char *exec_file, char *args, char **env) else child_cmd.command = xstrdup (args); - cmdline = (char *) alloca (strlen (args) + 4); - cmdline[0] = strlen (args); + cmdlen = strlen (args); + /* v2loadimage passes command lines via DOS memory, so it cannot + possibly handle commands longer than 1MB. */ + if (cmdlen > 1024*1024) + error ("Command line too long."); + + cmdline = xmalloc (cmdlen + 4); strcpy (cmdline + 1, args); - cmdline[strlen (args) + 1] = 13; + /* If the command-line length fits into DOS 126-char limits, use the + DOS command tail format; otherwise, tell v2loadimage to pass it + through a buffer in conventional memory. */ + if (cmdlen < 127) + { + cmdline[0] = strlen (args); + cmdline[cmdlen + 1] = 13; + } + else + cmdline[0] = 0xff; /* signal v2loadimage it's a long command */ environ = env; @@ -636,6 +651,7 @@ go32_create_inferior (char *exec_file, char *args, char **env) exit (1); } environ = env_save; + free (cmdline); edi_init (start_state); #if __DJGPP_MINOR__ < 3 |