diff options
author | Daniel Jacobowitz <drow@false.org> | 2008-11-24 18:05:02 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2008-11-24 18:05:02 +0000 |
commit | f142445f872fe237e7597c96c735dd03d9037bc5 (patch) | |
tree | 9dd934857249dcc75f889462bd07591e708c0a2b /gdb/gdbserver | |
parent | a0b7aece708587e6c4a33d9c62fd0fe73b990b6b (diff) | |
download | gdb-f142445f872fe237e7597c96c735dd03d9037bc5.zip gdb-f142445f872fe237e7597c96c735dd03d9037bc5.tar.gz gdb-f142445f872fe237e7597c96c735dd03d9037bc5.tar.bz2 |
* server.c (handle_v_run): Always use the supplied argument list.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 27 |
2 files changed, 15 insertions, 16 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 6928840..7b1d553 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -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> * xtensa-xtregs.c (XTENSA_ELF_XTREG_SIZE): Change to 4. diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 4adbf51..f8059e4 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1071,7 +1071,7 @@ handle_v_run (char *own_buf, char *status, int *signal) new_argc++; } - new_argv = malloc ((new_argc + 2) * sizeof (char *)); + new_argv = calloc (new_argc + 2, sizeof (char *)); i = 0; 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) { - /* GDB didn't specify a program to run. Try to use the argv - from the last run: either from the last vRun with a non-empty - argv, or from what the user specified if gdbserver was - started as: `gdbserver :1234 PROG ARGS'. */ + /* GDB didn't specify a program to run. Use the program from the + last run with the new argument list. */ if (program_argv == NULL) { @@ -1107,20 +1105,17 @@ handle_v_run (char *own_buf, char *status, int *signal) return 0; } - /* We can reuse the old args. We don't need this then. */ - free (new_argv); + new_argv[0] = strdup (program_argv[0]); } - else + + /* Free the old argv. */ + if (program_argv) { - /* Free the old argv. */ - if (program_argv) - { - for (pp = program_argv; *pp != NULL; pp++) - free (*pp); - free (program_argv); - } - program_argv = new_argv; + for (pp = program_argv; *pp != NULL; pp++) + free (*pp); + free (program_argv); } + program_argv = new_argv; *signal = start_inferior (program_argv, status); if (*status == 'T') |