From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6367 invoked by alias); 1 Sep 2018 15:36:38 -0000 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 Received: (qmail 6358 invoked by uid 89); 1 Sep 2018 15:36:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=learned, act X-HELO: mailsec119.isp.belgacom.be Received: from mailsec119.isp.belgacom.be (HELO mailsec119.isp.belgacom.be) (195.238.20.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 01 Sep 2018 15:36:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1535816194; x=1567352194; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=ENauzQ0JVytLZ3VSL45ghuM1cdexvm+0+MGXJCMwXjo=; b=hadEbnLBwhlqvNvpDeMmr+i1LUvkbzGi2emLY6Ph8A5guCqGyQiI3zQF DHmMm9MXUuLujL+7Ndt0ywSRfDWveQ==; Received: from 232.142-134-109.adsl-dyn.isp.belgacom.be (HELO md) ([109.134.142.232]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 01 Sep 2018 17:36:29 +0200 Message-ID: <1535816189.10641.3.camel@skynet.be> Subject: Re: [PATCH 2/2] gdb: Allow parenthesis to group arguments to user-defined commands From: Philippe Waroquiers To: Tom Tromey Cc: Andrew Burgess , gdb-patches@sourceware.org Date: Sat, 01 Sep 2018 15:36:00 -0000 In-Reply-To: <87zhx1qoxx.fsf@tromey.com> References: <1535225533.1438.5.camel@skynet.be> <1535230403.1438.10.camel@skynet.be> <20180825224310.GA32506@embecosm.com> <87lg8q7ai7.fsf@tromey.com> <20180828184331.GJ32506@embecosm.com> <1535488137.7778.4.camel@skynet.be> <20180828232948.GK32506@embecosm.com> <1535663976.7778.12.camel@skynet.be> <87h8jaz1zz.fsf@tromey.com> <1535800196.10641.1.camel@skynet.be> <87zhx1qoxx.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00007.txt.bz2 On Sat, 2018-09-01 at 08:20 -0600, Tom Tromey wrote: > > > > > > "Philippe" == Philippe Waroquiers writes: > > Philippe> What about the alternative solution to allow a user defined > Philippe> command to use $argu0, $argu1, $argu2, ... to do unquoted > Philippe> expansion when needed ? > > I think the problem is that people want to write user-defined commands > that act like other gdb commands, and in particular writing a > user-defined that takes an expression is, by far, the most common case. > > But, this proposal would mean that "print" would have one style of > quoting, while "user-print" would have another, drastically less nice, > style. Then maybe the conclusion is that we really need 2 different styles of quoting: * a quote mechanism to quote expressions, which then must have a 'balanced' nr of open/close parenthesis. * a quote mechanism (based on ' quoting) for non expressions args. Single quotes are already used by several native gdb commands (all gdb_argv based, and some others), but is (currently) poorly supported for user defined commands, which must be able to unquote an arg to pass it to native commands that do not expect quoted args.   The $argu approach then should allow to write user defined commands that have the same behaviour as the native commands. E.g. I believe the example 'info var for a bunch of REGEXP' is not implementable today, would still not be doable with parenthesis quoting, but is I believe implementable with the $argu approach. > > Personally I think people should just write Python, since it is a much > better way. But the CLI is more convenient, so here we are. > > Philippe> As far as I can see, gdb_argv is escaping single and double quotes, e.g. > Philippe> (gdb) handle 10 'ignore this \'bidule' > Philippe> Unrecognized or ambiguous flag word: "ignore this 'bidule". > Philippe> (gdb)  > > Yeah, I misremembered that. Thanks. Well, before you pointed me at gdb_argv, I even did not know it was existing :). So thanks to Andrew and you for this discussion, I learned a lot about gdb from it. Philippe