From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29180 invoked by alias); 10 Dec 2014 17:48:48 -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 29169 invoked by uid 89); 10 Dec 2014 17:48:47 -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: e06smtp12.uk.ibm.com Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 10 Dec 2014 17:48:47 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Dec 2014 17:48:43 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 10 Dec 2014 17:48:42 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6F26F17D8056 for ; Wed, 10 Dec 2014 17:49:04 +0000 (GMT) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBAHmglJ60621022 for ; Wed, 10 Dec 2014 17:48:42 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBAHmfVM011253 for ; Wed, 10 Dec 2014 10:48:41 -0700 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sBAHmeGC011237; Wed, 10 Dec 2014 10:48:41 -0700 From: Andreas Arnez To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Provide useful completer for "info registers" References: <87h9xnqje8.fsf@br87z6lw.de.ibm.com> <54809C18.1030102@redhat.com> Date: Wed, 10 Dec 2014 17:48:00 -0000 In-Reply-To: <54809C18.1030102@redhat.com> (Pedro Alves's message of "Thu, 04 Dec 2014 17:38:32 +0000") Message-ID: <87y4qfmm4m.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-0009-0000-0000-000002547106 X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00217.txt.bz2 On Thu, Dec 04 2014, Pedro Alves wrote: > Also, ... > > On 11/25/2014 05:28 PM, Andreas Arnez wrote: >> + for (i = 0; i < n_regs; i++) >> + { >> + const char *reg_name = gdbarch_register_name (gdbarch, i); >> + >> + if (reg_name != NULL && strncmp (text, reg_name, len) == 0) >> + VEC_safe_push (char_ptr, result, xstrdup (reg_name)); > > Not sure under which conditions "len" could be zero here. If it may, > note that some registers have empty names. See default_print_registers_info: > > /* If the register name is empty, it is undefined for this > processor, so don't display anything. */ > if (gdbarch_register_name (gdbarch, i) == NULL > || *(gdbarch_register_name (gdbarch, i)) == '\0') > continue; > >> + } >> + } Good point. This is fixed in the new version; registers with empty names are skipped now.