From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88891 invoked by alias); 6 Oct 2016 11:33:36 -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 88732 invoked by uid 89); 6 Oct 2016 11:33:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Ie, Adding, 1910 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 ESMTP; Thu, 06 Oct 2016 11:33:25 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 147604E4F5; Thu, 6 Oct 2016 11:33:24 +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 u96BXKo3009183; Thu, 6 Oct 2016 07:33:21 -0400 Subject: Re: [PATCH 4/5]: Enhancements to "flags": i386 cleanup To: Doug Evans , Anton Kolesov References: <047d7b5dbb865204bd052cf0bc2b@google.com> <2026a39c-0b53-9142-74ce-091bc73832d8@redhat.com> <7635a6d6-4059-6b23-952c-a88dbfef3b18@redhat.com> <187cd5cc-be8d-3a61-66cd-338ea68a72f8@redhat.com> Cc: gdb-patches , Wei-cheng Wang From: Pedro Alves Message-ID: Date: Thu, 06 Oct 2016 11:33:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00114.txt.bz2 [Adding Anton, this affects ARC] On 08/11/2016 07:18 PM, Doug Evans wrote: > On Thu, Aug 11, 2016 at 11:10 AM, Pedro Alves wrote: >> Is the "type" attribute used for anything in elements? >> Does changing the type of a flag bitfield have any user-visible >> effect at all? I.e., does a 1-bit uint32_t bitfield flag >> print differently from a bool bitfield flag? > > There may be some simplification possible, but note that bools do > print differently: if false we don't print the field at all. > > [digression: I'm not sure it's possible today, but while I understand > the desire to avoid the extra verbosity if we always printed false > fields, there are times when I *do* want the field printed even if > false] > So resulted in this change: diff --git a/gdb/features/arc-arcompact.c b/gdb/features/arc-arcompact.c index d1fa4fe..a527cc2 100644 --- a/gdb/features/arc-arcompact.c +++ b/gdb/features/arc-arcompact.c @@ -54,19 +54,19 @@ initialize_tdesc_arc_arcompact (void) feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); type = tdesc_create_flags (feature, "status32_type", 4); - tdesc_add_bitfield (type, "H", 0, 0); + tdesc_add_flag (type, 0, "H"); tdesc_add_bitfield (type, "E", 1, 2); tdesc_add_bitfield (type, "A", 3, 4); - tdesc_add_bitfield (type, "AE", 5, 5); - tdesc_add_bitfield (type, "DE", 6, 6); - tdesc_add_bitfield (type, "U", 7, 7); - tdesc_add_bitfield (type, "V", 8, 8); - tdesc_add_bitfield (type, "C", 9, 9); - tdesc_add_bitfield (type, "N", 10, 10); - tdesc_add_bitfield (type, "Z", 11, 11); - tdesc_add_bitfield (type, "L", 12, 12); - tdesc_add_bitfield (type, "R", 13, 13); - tdesc_add_bitfield (type, "SE", 14, 14); + tdesc_add_flag (type, 5, "AE"); + tdesc_add_flag (type, 6, "DE"); + tdesc_add_flag (type, 7, "U"); + tdesc_add_flag (type, 8, "V"); + tdesc_add_flag (type, 9, "C"); + tdesc_add_flag (type, 10, "N"); + tdesc_add_flag (type, 11, "Z"); + tdesc_add_flag (type, 12, "L"); + tdesc_add_flag (type, 13, "R"); + tdesc_add_flag (type, 14, "SE"); diff --git a/gdb/features/arc-v2.c b/gdb/features/arc-v2.c index c963410..b2bdfb5 100644 --- a/gdb/features/arc-v2.c +++ b/gdb/features/arc-v2.c @@ -54,23 +54,23 @@ initialize_tdesc_arc_v2 (void) feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); type = tdesc_create_flags (feature, "status32_type", 4); - tdesc_add_bitfield (type, "H", 0, 0); + tdesc_add_flag (type, 0, "H"); tdesc_add_bitfield (type, "E", 1, 4); - tdesc_add_bitfield (type, "AE", 5, 5); - tdesc_add_bitfield (type, "DE", 6, 6); - tdesc_add_bitfield (type, "U", 7, 7); - tdesc_add_bitfield (type, "V", 8, 8); - tdesc_add_bitfield (type, "C", 9, 9); - tdesc_add_bitfield (type, "N", 10, 10); - tdesc_add_bitfield (type, "Z", 11, 11); - tdesc_add_bitfield (type, "L", 12, 12); - tdesc_add_bitfield (type, "DZ", 13, 13); - tdesc_add_bitfield (type, "SC", 14, 14); - tdesc_add_bitfield (type, "ES", 15, 15); + tdesc_add_flag (type, 5, "AE"); + tdesc_add_flag (type, 6, "DE"); + tdesc_add_flag (type, 7, "U"); + tdesc_add_flag (type, 8, "V"); + tdesc_add_flag (type, 9, "C"); + tdesc_add_flag (type, 10, "N"); + tdesc_add_flag (type, 11, "Z"); + tdesc_add_flag (type, 12, "L"); + tdesc_add_flag (type, 13, "DZ"); + tdesc_add_flag (type, 14, "SC"); + tdesc_add_flag (type, 15, "ES"); tdesc_add_bitfield (type, "RB", 16, 18); - tdesc_add_bitfield (type, "AD", 19, 19); - tdesc_add_bitfield (type, "US", 20, 20); - tdesc_add_bitfield (type, "IE", 31, 31); + tdesc_add_flag (type, 19, "AD"); + tdesc_add_flag (type, 20, "US"); + tdesc_add_flag (type, 31, "IE"); Note how that left several flags with 2-bit and/or 4-bit long bitfields: tdesc_add_bitfield (type, "E", 1, 2); tdesc_add_bitfield (type, "A", 3, 4); ... tdesc_add_bitfield (type, "E", 1, 4); which I understand means these two fields will be given uint32_t type instead of bool? What does this mean in practice? E.g,. for "A", what do we print when both bits 3 and 4 are clear? What do we print if one of the bits is set and the other is clear? I see similar things on other archs though, it's not just ARC. E.g., the patch resulted in: --- a/gdb/features/aarch64.c +++ b/gdb/features/aarch64.c @@ -19,10 +19,10 @@ initialize_tdesc_aarch64 (void) feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.core"); type = tdesc_create_flags (feature, "cpsr_flags", 4); tdesc_add_flag (type, 0, "SP"); - tdesc_add_bitfield (type, "", 1, 1); + tdesc_add_flag (type, 1, ""); tdesc_add_bitfield (type, "EL", 2, 3); tdesc_add_flag (type, 4, "nRW"); - tdesc_add_bitfield (type, "", 5, 5); + tdesc_add_flag (type, 5, ""); tdesc_add_flag (type, 6, "F"); tdesc_add_flag (type, 7, "I"); tdesc_add_flag (type, 8, "A"); Which leaves "EL" as a 2-bit bitfield. I'm still terribly confused. :-/ Thanks, Pedro Alves