* server.c (handle_v_run): Always use the supplied argument list.

This commit is contained in:
Daniel Jacobowitz 2008-11-24 18:05:02 +00:00
parent a0b7aece70
commit f142445f87
2 changed files with 15 additions and 16 deletions

View File

@ -1,3 +1,7 @@
2008-11-24 Daniel Jacobowitz <dan@codesourcery.com>
* server.c (handle_v_run): Always use the supplied argument list.
2008-11-19 Bob Wilson <bob.wilson@acm.org> 2008-11-19 Bob Wilson <bob.wilson@acm.org>
* xtensa-xtregs.c (XTENSA_ELF_XTREG_SIZE): Change to 4. * xtensa-xtregs.c (XTENSA_ELF_XTREG_SIZE): Change to 4.

View File

@ -1071,7 +1071,7 @@ handle_v_run (char *own_buf, char *status, int *signal)
new_argc++; new_argc++;
} }
new_argv = malloc ((new_argc + 2) * sizeof (char *)); new_argv = calloc (new_argc + 2, sizeof (char *));
i = 0; i = 0;
for (p = own_buf + strlen ("vRun;"); *p; p = next_p) for (p = own_buf + strlen ("vRun;"); *p; p = next_p)
{ {
@ -1096,10 +1096,8 @@ handle_v_run (char *own_buf, char *status, int *signal)
if (new_argv[0] == NULL) if (new_argv[0] == NULL)
{ {
/* GDB didn't specify a program to run. Try to use the argv /* GDB didn't specify a program to run. Use the program from the
from the last run: either from the last vRun with a non-empty last run with the new argument list. */
argv, or from what the user specified if gdbserver was
started as: `gdbserver :1234 PROG ARGS'. */
if (program_argv == NULL) if (program_argv == NULL)
{ {
@ -1107,20 +1105,17 @@ handle_v_run (char *own_buf, char *status, int *signal)
return 0; return 0;
} }
/* We can reuse the old args. We don't need this then. */ new_argv[0] = strdup (program_argv[0]);
free (new_argv);
} }
else
/* Free the old argv. */
if (program_argv)
{ {
/* Free the old argv. */ for (pp = program_argv; *pp != NULL; pp++)
if (program_argv) free (*pp);
{ free (program_argv);
for (pp = program_argv; *pp != NULL; pp++)
free (*pp);
free (program_argv);
}
program_argv = new_argv;
} }
program_argv = new_argv;
*signal = start_inferior (program_argv, status); *signal = start_inferior (program_argv, status);
if (*status == 'T') if (*status == 'T')