From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17976 invoked by alias); 10 Dec 2014 17:36: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 17965 invoked by uid 89); 10 Dec 2014 17:36:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp15.uk.ibm.com Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 10 Dec 2014 17:36:02 +0000 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Dec 2014 17:35:59 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 10 Dec 2014 17:35:56 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 44ACF2190041 for ; Wed, 10 Dec 2014 17:35:27 +0000 (GMT) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBAHZukX59768860 for ; Wed, 10 Dec 2014 17:35:56 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBACWg04029162 for ; Wed, 10 Dec 2014 07:32:43 -0500 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sBACWgij029131; Wed, 10 Dec 2014 07:32:42 -0500 From: Andreas Arnez To: Pedro Alves Cc: Sergio Durigan Junior , gdb-patches@sourceware.org Subject: Re: [PATCH] Provide useful completer for "info registers" References: <87h9xnqje8.fsf@br87z6lw.de.ibm.com> <87ioi1bs3x.fsf@redhat.com> <54809B2C.8070707@redhat.com> Date: Wed, 10 Dec 2014 17:36:00 -0000 In-Reply-To: <54809B2C.8070707@redhat.com> (Pedro Alves's message of "Thu, 04 Dec 2014 17:34:36 +0000") Message-ID: <87388no1ac.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14121017-0021-0000-0000-000002177496 X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00215.txt.bz2 On Thu, Dec 04 2014, Pedro Alves wrote: > Thanks Andreas, > > I think a register completer is a great idea. Thanks, I thought so, too ;-) > > On 11/26/2014 08:54 PM, Sergio Durigan Junior wrote: >> I'd say this patch also needs a testcase :-). I know that this is >> architecture specific, so I'd personally be happy with something very >> simple, maybe testing only one or two architectures would be enough. > > I think $pc, $sp, $fp (the user regs) should work everywhere. > > See user-regs.c and std-regs.c. > > Actually, looks like the patch misses considering those for completion? > > See infcmd.c:registers_info: > > /* A register name? */ > { > int regnum = user_reg_map_name_to_regnum (gdbarch, start, end - start); > > if (regnum >= 0) > { > /* User registers lie completely outside of the range of > normal registers. Catch them early so that the target > never sees them. */ > if (regnum >= gdbarch_num_regs (gdbarch) > + gdbarch_num_pseudo_regs (gdbarch)) > { Yes, the patch misses them... Note that this is consistent with the list of registers shown by "mt print registers" or "info registers all". But you're right, the "info registers" command accepts user registers, so the completer should offer them as well. Added this in v3. It seems that user registers can not be listed by any means in GDB. Most architectures only have the built-in set of user registers ($pc, $sp, $fp, and $ps), but some define additional ones. This creates a difficulty with the test case, which tries to determine the full list of registers and reggroups the completer is supposed to yield. Thus I just added such a command in v3 as well.