From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5800 invoked by alias); 28 Aug 2018 20:29:04 -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 5436 invoked by uid 89); 28 Aug 2018 20:29:03 -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=replying, Q, q, abc X-HELO: mailsec117.isp.belgacom.be Received: from mailsec117.isp.belgacom.be (HELO mailsec117.isp.belgacom.be) (195.238.20.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Aug 2018 20:28:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1535488139; x=1567024139; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=IWe+lKItlphYfzWXN0RGVDFl9pGDJ1vpdffFJYrZDO0=; b=TI4efB5+2McPVGlqkaBJP2lVPWOhzfjKOD9MKPk0Vfx/0WuqG17QaQ9m YjXsQJkB5kcTYJ6B/AX22OV0V4Lz7A==; 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; 28 Aug 2018 22:28:57 +0200 Message-ID: <1535488137.7778.4.camel@skynet.be> Subject: Re: [PATCH 2/2] gdb: Allow parenthesis to group arguments to user-defined commands From: Philippe Waroquiers To: Andrew Burgess , Tom Tromey Cc: gdb-patches@sourceware.org Date: Tue, 28 Aug 2018 20:29:00 -0000 In-Reply-To: <20180828184331.GJ32506@embecosm.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> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00712.txt.bz2 On Tue, 2018-08-28 at 19:43 +0100, Andrew Burgess wrote: > * Tom Tromey [2018-08-28 09:53:52 -0600]: > > > > > > > > "Andrew" == Andrew Burgess writes: > > > > Andrew> So, my suggestion deliberately avoids using quotes or backslashes as > > Andrew> these are bogged down in the existing code. And using (...) is fairly > > Andrew> intuitive given GDBs C like expression handling, personally I'd rather > > Andrew> write: > > Andrew> my_command ({unsigned long long} &global_var) > > Andrew> than: > > Andrew> my_command {unsigned\ long\ long}\ &global_var > > > > FWIW I tend to agree with your logic here. > > > > User-defined argument parsing is broken (and I think there's at least > > one bug in bugzilla about this), but at the same time, making breaking > > changes seems unfriendly. Your approach doesn't seem to be breaking > > anything that is likely to be actually used. I do not think a \ followed by a space will create a lot of incompatibilities. i .e. that someone would type some_user_defined_command a\ b to give 2 different args to the command. For single quotes: it is unlikely that someone types something like some_user_defined_command 'abc def' and was expecting the user defined command to receive two args. What is however a lot more likely is some_user_defined_command 'a' and this command expects to receive a character value. So, yes, single quotes has more potential to create incompatibilities. On the downside, quoting with parenthesis is something very peculiar (is there some other tool/shell/... using this convention ?). And from a previous discussion with Pedro, he indicated that some commands in gdb already are using single quotes. The 'Not sure' below is a quote of Pedro :), replying to a suggestion I gave to let the user tell explicitly if an arg was quoted or not. >   * have a way to (explicitely) quote an argument e.g. >       info var  -Qt 'long int'  regexpofsomevars >     where -Q indicates that the next "value argument" is >     explicitely quoted. Not sure we need that -Q.  We can support optional quotes, and tell users to add quotes if necessary?  That's what we've done since forever in linespecs and expressions, for example. It is based on this that I used single quotes in the  info var/func/arg/local -t TYPEREGEXP NAMEREGEXP patch. > Given that the argument passing for user-defined functions is pretty > self contained we could, conceivably, implement a whole new system and > have a switch to select between them... the existing code does seem > rather odd. > > But ideally, I'd like that to be a project for another day. And we also have the 'generalised arg parser' prototype that Pedro has in a corner. IMO, clearly, what to do is unclear :). Philippe