From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3177 invoked by alias); 24 Nov 2014 05:39: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 3164 invoked by uid 89); 24 Nov 2014 05:39:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f50.google.com Received: from mail-wg0-f50.google.com (HELO mail-wg0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 24 Nov 2014 05:39:02 +0000 Received: by mail-wg0-f50.google.com with SMTP id k14so11333047wgh.9 for ; Sun, 23 Nov 2014 21:38:59 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.228.72 with SMTP id sg8mr7807501wic.48.1416807539052; Sun, 23 Nov 2014 21:38:59 -0800 (PST) Received: by 10.27.132.70 with HTTP; Sun, 23 Nov 2014 21:38:58 -0800 (PST) In-Reply-To: <20141123095317.GE5774@adacore.com> References: <20141123042417.GA839@adacore.com> <87bnny45zi.fsf@igel.home> <20141123095317.GE5774@adacore.com> Date: Mon, 24 Nov 2014 05:39:00 -0000 Message-ID: Subject: Re: RFC: "set" command with 2 arguments instead of one? From: Doug Evans To: Joel Brobecker Cc: Andreas Schwab , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg00596.txt.bz2 On Sun, Nov 23, 2014 at 1:53 AM, Joel Brobecker wrote: >> > It proposes the introduction of a couple of commands, one to dump >> > the contents of the of the bounds table, and one to set the bounds >> > for any given address. Since those commands are MPX-specific, >> > I would like to have them prefixed somehow. But the beyond the >> > fact that I'd like to have them prefixed, I was wondering if >> > set/show commands could be used for that. Eg: >> > >> > show mpx bound ADDR >> > set mpx bound ADDR LBOUND UBOUND >> > >> > The reason why I am asking for comments is that the "set" command >> > above has a syntax which is slightly unusual for "set" commands >> > in the sense that "set" commands nearly always only have one argument, >> > whereas it has 3 in this case. >> >> How do you parse the arguments if they are arbitrary expressions? > > I think that this is a question which is othogonal to the question > I am asking. If you need a command that takes multiple arguments, > and some of these arguments are going to be arbitrary expressions, > you're going to have a parsing problem regardless of the name of > the command you're choosing. And each command, regardless of the > name of the command they decide on, can determine how they handle it. > For instance, they could use quoting, a la shell. > > But in the particular case that interests us, there are no arbitrary > expressions as of yet. This feels like a case where we need to at least think about some future-proofing. One way some commands separate expressions is with commas. I'm not fond of optional commas (setting aside the thread on info macro -at LOCATION,). IOW, if it turns out that we want to use commas down the road to separate expressions here, then I'd prefer the commas be required today. E.g., set mpx bound ADDR, LBOUND, UBOUND As for how to process multiple arguments to a "set" command, one way would be to stage the value in a string parameter, and then have a set handler post-process the result.