This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove vAttach and vRun unneeded requirement


Hi,

The vAttach packet, which is used to implement the attach command
in the extended-remote target, in it's documentation says that if the
stub is currently controlling a process, it is killed.

`vAttach;pid'
    Attach to a new process with the specified process ID. pid is a 
hexadecimal integer identifying the process. If the stub is currently 
controlling a process, it is killed. The attached process is stopped.

This requirement isn't really needed, since gdb already takes care
of killing the running inferior.

We would like to remove this requirement, since it has no real value,
and limits future extensions for stubs controlling more than one
process at a time.

So, that's what the attached patch does.  It removes that frase,
and removes the implementation for it in the probably only
current implementation of it: gdbserver on HEAD.

I'd like to have this committed before the release, since there's
no release with this packet yet.

Tested with a local gdbserver on x86_64-unknown-linux-gnu, no
regressions, and by looking at the generated html docs.

-- 
Pedro Alves
doc/
2008-02-19  Pedro Alves  <pedro@codesourcery.com>

	* gdb.texinfo (vAttach): Remove requirement of the stub killing
	the inferior when it is already debugging a process.

gdbserver/
2008-02-19  Pedro Alves  <pedro@codesourcery.com>

	* 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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]