From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49090 invoked by alias); 5 Jun 2018 16:49:09 -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 46807 invoked by uid 89); 5 Jun 2018 16:49:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=this, remark, this! X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Jun 2018 16:49:07 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 039BDC937C; Tue, 5 Jun 2018 16:49:06 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D9802026988; Tue, 5 Jun 2018 16:49:05 +0000 (UTC) Subject: Re: [RFA 0/8] Implement 'frame apply COMMAND', enhance 'thread apply COMMAND' To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20180521110651.13842-1-philippe.waroquiers@skynet.be> <15ccf634-d702-d964-1ebc-19793814e0b9@redhat.com> <1527881895.1703.16.camel@skynet.be> <87de48ff-494b-4837-d93a-9e048446b75c@redhat.com> <1528145780.1703.27.camel@skynet.be> From: Pedro Alves Message-ID: <505abf66-d602-dc5f-069c-d063d2bac986@redhat.com> Date: Tue, 05 Jun 2018 16:49:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1528145780.1703.27.camel@skynet.be> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-06/txt/msg00104.txt.bz2 On 06/04/2018 09:56 PM, Philippe Waroquiers wrote: > On Mon, 2018-06-04 at 17:46 +0100, Pedro Alves wrote: >> >> Note that "b -function foo (int) -line 10" works, even >> though there's a space in "foo (int)", because the explicit >> location's parser was taught to skip past function names, >> and in that case, we know that ()s are balanced. But it's >> tricky code, and the same probably can't be done for >> REGEXPs, I think. > Such arg parsing intelligence might make a > generic parser framework somewhat more tricky, > or at least the generic framework will have to "know" > the syntax of all such specially parsed options, > or maybe delegate the parsing of some arguments > to some arg specific code depending on the option type, > which can then make e.g. the -- end of option recognition > to be done at several places. > And effectively, see where a REGEXP terminates and see > where the next REGEXP starts is not doable without > quoting. Yeah. I haven't tried converting the explicit locations parser to the new framework, because that parser is very tricky. > Note we already have some worry with the current status: > E.g. break -l meaning depends on how many options > starts with -l, and in which order the code checks them. > If break was accepting initially only -line, > and -label is added as a new option : if the code first > checks for -label, then -l will change of semantic > and/or cause an error. Not as bad IMHO, but true regardless. > Note that the doc for break says the abbreviation must have > the unique prefix characters, but that of course > depends on the future options being added > (and today, break -l is accepted and interpreted as break -line). > > Note that getopt does not accept ambiguity e.g. : > $ ls --a > ls: option '--a' is ambiguous; possibilities: '--all' '--author' '--almost-all' Yeah. Traditionally GDB makes it so that old common shorthands continue working. It's the same with command names too. E.g., "t" for "thread", even though "t" is ambiguous. So I see the options following the same principle. >>> then I think we can make something backward compatible >>> but go to a more uniform option/arg parsing (and avoid >>> 'local' re-implementation of option parsing logic such as >>> skip spaces etc). >>> Of course, if in this patchn, we mandate -v -v -c -s >>> instead of -vvcs, that would be equally compatible with the >>> future option/arg parser >>> ('future' is the politically correct synonym of vapourware :). >> >> I resent the "vapourware" remark. :-P It's real! :-P > Humph, sorry. I wanted to indicate my own suggestion > (a getopt like parser for --longoptions) was vapourware. Ah, the joys of text communication misunderstandings. No need to apologize, I was just kidding. :-) >>> and I found e.g. >>> t a a -s f a a -s  >>> quite long to type, and so worth the aliases. >> >> I wonder whether that's a real use case in practice though. >> What sort of thing does one want to print in all frames >> of all threads? Genuinely curious. > The idea is to let gdb discover where a certain variable > or argument exists and can be printed. > This helps when things are optimised out in one frame, > but can be printed in upper frames (or upper > scope/nested blocks in Ada). > > Another possible use case is something like : > tfaas info local -t sometype > to see all local vars in all frames of all threads > that have the given type. For example, sometype > might be an RAII type that locks whatever :  > this is then a quick way to discover all active locks. Interesting. I wonder whether it would make sense to give some example like this in the manual. > At this point, it looks clear to me we better do not allow > combined short options. If we want to support combined short options > one day, then as you suggested, we need another syntax to combine them: > frame apply all /cvv p somevar > > In the meantime, I can rework the patch to (only) accept separately > the -c -s -v -q flags. > > Does that sound like a correct plan to you ? Yes, it does. Thanks for doing all this! Pedro Alves