From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23064 invoked by alias); 15 Oct 2010 23:47:11 -0000 Received: (qmail 23054 invoked by uid 22791); 15 Oct 2010 23:47:11 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Oct 2010 23:47:07 +0000 Received: (qmail 1284 invoked from network); 15 Oct 2010 23:47:05 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Oct 2010 23:47:05 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [MI][patch] broken -target-detach Date: Fri, 15 Oct 2010 23:47:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.33-29-realtime; KDE/4.4.2; x86_64; ; ) Cc: Marc Khouzam References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010160047.03094.pedro@codesourcery.com> 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: 2010-10/txt/msg00259.txt.bz2 On Monday 27 September 2010 21:25:27, Marc Khouzam wrote: > Hi, > > with GDB 7.2, the MI command -target-detach is not working very well. > It still assumes that the thread-group id is a pid, instead of the > new thread-group id format which starts with an 'i'. > Also, the usage printout does not correspond to the documentation: > > Usage: -target-detach [thread-group] > vs > -target-detach [ pid | gid ] Yeah. I think it used to correspond implicitly, since the thread group id in 7.0 and 7.1 was actually equal to the pid, IIRC. With 7.2, the 1-1 correspondence disappeared, but this command appears to have been forgotten. One would hope that frontends would stop using the PID form, cause you may want to detach from targets that don't have a PID concept at all, and even though GDB fakes a PID for you today in such cases, it's better to not assume that. Unfortunately, 7.2 was released accepting the PID form only, so we may be better off continue accepting it... > I have a patch that fixes things to parse both a pid or a thread-group. > I've added it at the bottom, but I'm not sure it is the right approach. > With the new global MI flag --thread-group, I wonder if -target-detach > should take a thread-group as a parameter anymore. > Note that although "-target-detach i1" does not work, > "-target-detach --thread-group i1" works. > I'm not sure what would happen if I did: > "-target-detach --thread-group i1 " > I'm guessing the --thread-group flag would get ignored. > > What should we do about this? FWIW, codewise, your patch also looked good to me. (though IMO it'd be clearer to check for *argv[0] == 'i' even before trying to parse a number with strtol.) -- Pedro Alves