doc/ 2008-02-19 Pedro Alves * gdb.texinfo (vAttach): Remove requirement of the stub killing the inferior when it is already debugging a process. gdbserver/ 2008-02-19 Pedro Alves * server.c (handle_v_requests): When handling the vRun and vAttach packets, if already debugging a process, don't kill it. Return an error instead. --- gdb/doc/gdb.texinfo | 6 +++--- gdb/gdbserver/server.c | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) Index: src/gdb/doc/gdb.texinfo =================================================================== --- src.orig/gdb/doc/gdb.texinfo 2008-02-15 21:46:56.000000000 +0000 +++ src/gdb/doc/gdb.texinfo 2008-02-15 23:35:15.000000000 +0000 @@ -23706,8 +23706,8 @@ up to the first @samp{;} or @samp{?} (or @item vAttach;@var{pid} @cindex @samp{vAttach} packet Attach to a new process with the specified process ID. @var{pid} is a -hexadecimal integer identifying the process. If the stub is currently -controlling a process, it is killed. The attached process is stopped. +hexadecimal integer identifying the process. The attached process is +stopped. This packet is only available in extended mode (@pxref{extended mode}). @@ -23821,7 +23821,7 @@ Run the program @var{filename}, passing command line. The file and arguments are hex-encoded strings. If @var{filename} is an empty string, the stub may use a default program (e.g.@: the last program run). The program is created in the stopped -state. If the stub is currently controlling a process, it is killed. +state. This packet is only available in extended mode (@pxref{extended mode}). Index: src/gdb/gdbserver/server.c =================================================================== --- src.orig/gdb/gdbserver/server.c 2008-02-15 21:23:16.000000000 +0000 +++ src/gdb/gdbserver/server.c 2008-02-15 23:33:56.000000000 +0000 @@ -928,8 +928,9 @@ handle_v_requests (char *own_buf, char * { if (target_running ()) { - fprintf (stderr, "Killing inferior\n"); - kill_inferior (); + fprintf (stderr, "Already debugging a process\n"); + write_enn (own_buf); + return; } handle_v_attach (own_buf, status, signal); return; @@ -939,8 +940,9 @@ handle_v_requests (char *own_buf, char * { if (target_running ()) { - fprintf (stderr, "Killing inferior\n"); - kill_inferior (); + fprintf (stderr, "Already debugging a process\n"); + write_enn (own_buf); + return; } handle_v_run (own_buf, status, signal); return;