From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24089 invoked by alias); 10 May 2007 21:35:52 -0000 Received: (qmail 24079 invoked by uid 22791); 10 May 2007 21:35:51 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.172) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 May 2007 21:35:46 +0000 Received: by ug-out-1314.google.com with SMTP id 75so583925ugb for ; Thu, 10 May 2007 14:35:43 -0700 (PDT) Received: by 10.67.92.1 with SMTP id u1mr1933492ugl.1178832943393; Thu, 10 May 2007 14:35:43 -0700 (PDT) Received: from ?88.210.90.92? ( [88.210.90.92]) by mx.google.com with ESMTP id m1sm4909584ugc.2007.05.10.14.35.41; Thu, 10 May 2007 14:35:42 -0700 (PDT) Message-ID: <46438FE4.9030806@portugalmail.pt> Date: Thu, 10 May 2007 21:35:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [RFC] [gdbserver/win32] Enable detaching on MinGW. References: <463FDC1C.8020302@portugalmail.pt> <20070510185704.GC27802@caradoc.them.org> In-Reply-To: <20070510185704.GC27802@caradoc.them.org> Content-Type: multipart/mixed; boundary="------------090502090408040302080708" X-IsSubscribed: yes 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: 2007-05/txt/msg00169.txt.bz2 This is a multi-part message in MIME format. --------------090502090408040302080708 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1097 Daniel Jacobowitz wrote: > On Tue, May 08, 2007 at 03:10:36AM +0100, Pedro Alves wrote: >> Hi all, >> >> Currently detach support is skipped on MinGW (and mingw32ce), >> because there is no waitpid on Windows. This patch enables it >> by implementing the waiting for the inferior to exit in a new >> target_op::join. >> >> One thing that annoys me, is that requesting for detach kills the >> inferior if detaching isn't supported. The patch makes gdbserver >> return an error (E packet) to gdb, so gdb knows it shouldn't >> stop debugging. The user can then kill the inferior is he wants. >> >> What do you think of this behavior? >> >> Is the patch OK? > > The gdbserver parts are fine. > >> - remote_send (&rs->buf, &rs->buf_size); >> + putpkt (rs->buf); >> + getpkt (&rs->buf, &rs->buf_size, 0); >> + >> + if (rs->buf[0] == 'E') >> + error (_("Can't detach process.")); > > Isn't this basically what happens already in remote_send? Oh, but we > have a better error message now. This part's OK too. > Thanks. I've also committed the following as obvious. Cheers, Pedro Alves --------------090502090408040302080708 Content-Type: text/x-diff; name="fix_detach.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix_detach.diff" Content-length: 1254 2007-05-10 Pedro Alves * linux-low.c (linux_detach): Change return type to int. Return 0. * spu-low.c (spu_detach): Likewise. --- gdb/gdbserver/linux-low.c | 3 ++- gdb/gdbserver/spu-low.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) Index: src/gdb/gdbserver/linux-low.c =================================================================== --- src.orig/gdb/gdbserver/linux-low.c 2007-05-10 21:55:20.000000000 +0100 +++ src/gdb/gdbserver/linux-low.c 2007-05-10 22:22:04.000000000 +0100 @@ -287,10 +287,11 @@ linux_detach_one_process (struct inferio ptrace (PTRACE_DETACH, pid_of (process), 0, 0); } -static void +static int linux_detach (void) { for_each_inferior (&all_threads, linux_detach_one_process); + return 0; } static void Index: src/gdb/gdbserver/spu-low.c =================================================================== --- src.orig/gdb/gdbserver/spu-low.c 2007-05-10 21:55:20.000000000 +0100 +++ src/gdb/gdbserver/spu-low.c 2007-05-10 22:22:46.000000000 +0100 @@ -314,10 +314,11 @@ spu_kill (void) } /* Detach from inferior process. */ -static void +static int spu_detach (void) { ptrace (PTRACE_DETACH, current_tid, 0, 0); + return 0; } static void --------------090502090408040302080708--