From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14311 invoked by alias); 12 Dec 2014 17:45:59 -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 14288 invoked by uid 89); 12 Dec 2014 17:45:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-vc0-f180.google.com Received: from mail-vc0-f180.google.com (HELO mail-vc0-f180.google.com) (209.85.220.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 12 Dec 2014 17:45:57 +0000 Received: by mail-vc0-f180.google.com with SMTP id im6so3871395vcb.39 for ; Fri, 12 Dec 2014 09:45:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=2ClbSZM1eLMkAzYaSrKJsNyBTirknqBCBiCHik/dPYE=; b=RddCIzRCgSliSFViMjUbRcoVCl741b34rSH43EmZhN5czYNVyW8k+EusLb0SMiqpIg y2KXrRDy7MQAtvdWc4N31duE7WH3u0I3Dd1FS2zxe/qflYxUe8ASiIQ66hgYQA1+JTjN g6Rp7Kh7elyRDv6sofN7/pC86dcOBMWbE4qqnbu4wXFU6NOpQLdPNRW6YPrHwZNruWNu u5YYTNEzVLOkco7aluGaxdSZCNueSdG0MDY0pmq3GnhBuIxzOHuZLIS8ldA0qHqCH6Rz 3c1dGmvj/JNM6phojyKuLouMgE7Zdij3oEkpWrzbL3WcJ+RkP1mOavywy1S+JbpoDC+c k9Zg== X-Gm-Message-State: ALoCoQmFBgYXEPG5gDczxCn/NM/Doi/rxBpePXab7cL/3b0+7IkPpZcfe/4/5jzEjak4gSNAm1KK MIME-Version: 1.0 X-Received: by 10.52.231.165 with SMTP id th5mr9313594vdc.48.1418406355617; Fri, 12 Dec 2014 09:45:55 -0800 (PST) Received: by 10.52.114.101 with HTTP; Fri, 12 Dec 2014 09:45:55 -0800 (PST) In-Reply-To: <877fxwnbd6.fsf@br87z6lw.de.ibm.com> References: <1418298589-23120-1-git-send-email-arnez@linux.vnet.ibm.com> <1418298589-23120-3-git-send-email-arnez@linux.vnet.ibm.com> <548AEB86.60809@redhat.com> <877fxwnbd6.fsf@br87z6lw.de.ibm.com> Date: Fri, 12 Dec 2014 17:45:00 -0000 Message-ID: Subject: Re: [PATCH v4 2/2] Provide completer for "info registers" From: Doug Evans To: Andreas Arnez Cc: Pedro Alves , gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00292.txt.bz2 On Fri, Dec 12, 2014 at 7:20 AM, Andreas Arnez wrote: > On Fri, Dec 12 2014, Pedro Alves wrote: > >> On 12/11/2014 11:49 AM, Andreas Arnez wrote: >> >>> +set regs_output [capture_command_output "mt print registers" \ >>> + ".*Name.*Nr.*Rel.*Offset.*Size.*Type.\[^\n\]*\n"] >>> +append regs_output "\n" >>> +append regs_output [capture_command_output "mt print reggroups" \ >>> + ".*Group.*Type\[^\n]*\n"] >>> +set all_regs {} >>> +foreach {-> reg} [regexp -all -inline -line {^\s+(\w+\S*)} $regs_output] { >> >> This "->" here confused me a little. AFAIK, $- is a more common "don't care" >> variable (and what foreach's documentation suggests). Any reason to >> pick -> instead? > > I think I've borrowed this from an example in the regexp's > documentation: > > regexp {\mfoo(?!bar\M)(\w*)} $string -> restOfWord > > Admittedly, in the foreach case this does not look as nicely. So I will > change it to "-", as suggested. > >> Also, why do we need the "\S*" ? I'd assume {^\s+(\w+)} works just as well. > > OK, all existing register and reggroup names consist wholly of > alphanumeric and underscore characters. So I will change the pattern as > suggested. > >> >>> + lappend all_regs $reg >>> +} >>> + >>> +set regs_output [capture_command_output "mt print user-registers" \ >>> + ".*Nr.*Name\[^\n]*\n"] >>> +foreach {-> reg} [regexp -all -inline -line {\d+\s+(\w+\S*)} $regs_output] { >> >> Likewise. > > Yes. And looking at it again, I think that this pattern should be more > consistent with the one above and match the whole beginning of a line. > Thus I will rephrase it to {^\s+\d+\s+(\w+)}. In this way the command > can add more columns in the future without having to adjust the pattern > here. > >> Otherwise this looks good to me. > > Thanks. Will push this then with changes below. > > -- > > --- a/gdb/testsuite/gdb.base/completion.exp > +++ b/gdb/testsuite/gdb.base/completion.exp > @@ -146,13 +146,13 @@ append regs_output "\n" > append regs_output [capture_command_output "mt print reggroups" \ > ".*Group.*Type\[^\n]*\n"] > set all_regs {} > -foreach {-> reg} [regexp -all -inline -line {^\s+(\w+\S*)} $regs_output] { > +foreach {- reg} [regexp -all -inline -line {^\s+(\w+)} $regs_output] { > lappend all_regs $reg > } > > set regs_output [capture_command_output "mt print user-registers" \ > ".*Nr.*Name\[^\n]*\n"] > -foreach {-> reg} [regexp -all -inline -line {\d+\s+(\w+\S*)} $regs_output] { > +foreach {- reg} [regexp -all -inline -line {^\s+\d+\s+(\w+)} $regs_output] { > lappend all_regs $reg > } > Hi. I'm seeing the following new failure on amd64-linux: (gdb) complete info registers ^M info registers ah^M info registers al^M ... info registers ymm9^M info registers ymm9h^M (gdb) FAIL: gdb.base/completion.exp: complete 'info registers '