From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46558 invoked by alias); 9 Jun 2015 16:45:08 -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 46533 invoked by uid 89); 9 Jun 2015 16:45:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 09 Jun 2015 16:45:06 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 8ADE2B6E83; Tue, 9 Jun 2015 16:45:05 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t59Gj2Qv012549; Tue, 9 Jun 2015 12:45:03 -0400 Message-ID: <5577180E.8030309@redhat.com> Date: Tue, 09 Jun 2015 16:45:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andrew Burgess , gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] gdb: Rework command completion on 'tui reg'. References: <58e17eaffc56924038a839aa42e00a96dc1832b5.1432246159.git.andrew.burgess@embecosm.com> <55607DF7.8040601@redhat.com> <20150602101111.GO17330@embecosm.com> In-Reply-To: <20150602101111.GO17330@embecosm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-06/txt/msg00137.txt.bz2 On 06/02/2015 11:11 AM, Andrew Burgess wrote: > Thanks for the review. I've reworked the patch to address all the > issues raised. Here's the new version. > Thanks. Sorry for the delay, I was away last week. This version looks fine apart from a couple details. Go ahead and push with these fixed. > gdb/ChangeLog: > > * completer.c Add arch-utils.h include. Missing colon. > -/* Complete on a register or reggroup. */ > +/* Bit-flags for selecting what the register and/or register-group > + completer should complete on. */ > > -VEC (char_ptr) * > -reg_or_group_completer (struct cmd_list_element *ignore, > - const char *text, const char *word) > +enum reg_completer_targets > + { > + complete_register_names = 0x1, > + complete_reggroup_names = 0x2 > + }; > + > +/* Complete on a register names (when WITH_REGISTERS is true) and/or > + reggroup names (when WITH_REGGROUPS) is true. One, or both of > + WITH_REGISTERS and WITH_REGGROUPS must be true. */ The comment is stale wrt to the bit flags. > + > +static VEC (char_ptr) * > +reg_or_group_completer_1 (struct cmd_list_element *ignore, > + const char *text, const char *word, > + enum reg_completer_targets targets) > { > VEC (char_ptr) *result = NULL; > size_t len = strlen (word); > struct gdbarch *gdbarch; > - struct reggroup *group; > const char *name; > - int i; > > if (!target_has_registers) > return result; Unless I'm missing something, I think you need to remove this check, otherwise completion doesn't really work when there's no running program yet. > > - gdbarch = get_frame_arch (get_selected_frame (NULL)); > + gdb_assert ((targets & (complete_register_names > + | complete_reggroup_names)) != 0); > + gdbarch = get_current_arch (); > > +following groups are avaiable on most targets: typo "available". Thanks, Pedro Alves