From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16083 invoked by alias); 19 Feb 2008 02:04:41 -0000 Received: (qmail 16073 invoked by uid 22791); 19 Feb 2008 02:04:39 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 19 Feb 2008 02:04:21 +0000 Received: (qmail 8387 invoked from network); 19 Feb 2008 02:04:19 -0000 Received: from unknown (HELO pedro-laptop-dell.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 19 Feb 2008 02:04:19 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Remove vAttach and vRun unneeded requirement Date: Tue, 19 Feb 2008 02:04:00 -0000 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_ikjuHylX6VNzfl0" Message-Id: <200802190204.18131.pedro@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00309.txt.bz2 --Boundary-00=_ikjuHylX6VNzfl0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1087 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 --Boundary-00=_ikjuHylX6VNzfl0 Content-Type: text/x-diff; charset="us-ascii"; name="dont_kill_on_attach.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dont_kill_on_attach.diff" Content-length: 2580 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; --Boundary-00=_ikjuHylX6VNzfl0--