diff options
author | Pedro Alves <palves@redhat.com> | 2008-10-10 14:06:05 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-10-10 14:06:05 +0000 |
commit | 9b710a42944c3979ed9c8fae8b163ec5353f9c47 (patch) | |
tree | 9d61e8a36857dd1977e63b76478467ff4ce266aa /gdb/gdbserver | |
parent | 8a9629d090d1eef694c535bb22badb2fe047ae0a (diff) | |
download | gdb-9b710a42944c3979ed9c8fae8b163ec5353f9c47.zip gdb-9b710a42944c3979ed9c8fae8b163ec5353f9c47.tar.gz gdb-9b710a42944c3979ed9c8fae8b163ec5353f9c47.tar.bz2 |
* server.c (handle_v_run): If GDB didn't specify an argv, use the
whole argv from the last run, not just argv[0].
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 24 |
2 files changed, 21 insertions, 8 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 0b5d10b..225537d 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2008-10-10 Pedro Alves <pedro@codesourcery.com> + + * server.c (handle_v_run): If GDB didn't specify an argv, use the + whole argv from the last run, not just argv[0]. + 2008-09-08 Pedro Alves <pedro@codesourcery.com> * regcache.c (new_register_cache): Return NULL if the register diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 60df3d8..4adbf51 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1096,23 +1096,31 @@ 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'. */ + if (program_argv == NULL) { write_enn (own_buf); return 0; } - new_argv[0] = strdup (program_argv[0]); + /* We can reuse the old args. We don't need this then. */ + free (new_argv); } - - /* Free the old argv. */ - if (program_argv) + else { - for (pp = program_argv; *pp != NULL; pp++) - free (*pp); - free (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; } - program_argv = new_argv; *signal = start_inferior (program_argv, status); if (*status == 'T') |