From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 7FA88384F010 for ; Thu, 15 Jul 2021 17:20:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7FA88384F010 Received: by mail-ed1-x536.google.com with SMTP id t2so8815607edd.13 for ; Thu, 15 Jul 2021 10:20:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-description:content-disposition:in-reply-to; bh=3dh/UxzdbFO7M+LjyWSAOCaqbyrf0DulRKhnpWzxTOk=; b=T1w4U2H8wUEiL0ghcf5fWDZFlDK8IQRzvOVx2lLkRsNnxqd69R2d0D7yPiGeRMLGxK ulkDHWn0/LazofoVtN1SK52iV0Qg4gMx8kaMxVw7Maknsnk6SBzhnZhu2U64btV3WDtx we31qc0i3FG8o+LoeyYhtpqnqJKz79V7iTI0TIRlot1+Ecz7pneDr4RDh+jQ3n4o9JXp J4Q1lKN6cnolwlrknWw9OkzQsoCGLQMHOT3/yHYLHOTzztzf9+OGsc5CQE+78l5KbQaB aja4rH0tu/4lD5YzJOYK/jVyzsS9FgLykYpUWqrqtKr/BpBn/gE9hOlFSa1SuT9iiP6B e7Fw== X-Gm-Message-State: AOAM5327GLR8ebQgvWxTjTG6Gg6LKFzINxyUdbq8QoUyhSMK0FYHOZWS RTw4jcqpARECxSgVfdsezRhP0Ml91ckwNQ== X-Google-Smtp-Source: ABdhPJyszXTR7hlaWPrUMZoUVoEBKNkIwol57zz0UhHaU2wNaknFCp3qiwUZ7lGHSFyGtqkBUCI6uA== X-Received: by 2002:a05:6402:1a25:: with SMTP id be5mr8636269edb.123.1626369641688; Thu, 15 Jul 2021 10:20:41 -0700 (PDT) Received: from gmail.com ([2a03:1b20:3:f011::13d]) by smtp.gmail.com with ESMTPSA id dn23sm2719944edb.56.2021.07.15.10.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 10:20:40 -0700 (PDT) Date: Thu, 15 Jul 2021 19:21:03 +0200 From: Shahab Vahedi To: Simon Marchi Cc: gdb@sourceware.org Subject: Re: Custom types in target description XMLs Message-ID: References: <429b4e0f-032b-b946-2f59-ff2f729b1005@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Description: solution Content-Disposition: inline In-Reply-To: <429b4e0f-032b-b946-2f59-ff2f729b1005@polymtl.ca> X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FSL_HELO_FAKE, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 17:20:44 -0000 Hi Simon, On Thu, Jul 15, 2021 at 10:37:39AM -0400, Simon Marchi wrote: > Given the lack of response, I would say that nobody knows that off-hand, > and you would need to dive into the code to check what is happening, if > it's a GDB bug or something else. I was just about to write another email. I have investigated both of the problems and they seem like a bug to me. The following change fixes the "field" type issue: ------------------------8<------------------------ diff --git a/gdb/valprint.c b/gdb/valprint.c index 0749f38983e..91602b41274 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1186,7 +1186,7 @@ val_print_type_code_flags (struct type *type, ... { unsigned field_len = TYPE_FIELD_BITSIZE (type, field); ULONGEST field_val - = val >> (TYPE_FIELD_BITPOS (type, field) - field_len + 1); + = val >> TYPE_FIELD_BITPOS (type, field); if (field_len < sizeof (ULONGEST) * TARGET_CHAR_BIT) field_val &= ((ULONGEST) 1 << field_len) - 1; ------------------------>8------------------------ And this one solves the "struct" type problem: ------------------------8<------------------------ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 43c05d344d0..68e65ef8bb5 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5805,7 +5805,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch) builtin_type->builtin_string = arch_type (gdbarch, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string"); builtin_type->builtin_bool - = arch_type (gdbarch, TYPE_CODE_BOOL, TARGET_CHAR_BIT, "bool"); + = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "bool"); /* The following three are about decimal floating point types, which are 32-bits, 64-bits and 128-bits respectively. */ ------------------------>8------------------------ I will file two separate bugs and then submit the two patches with the explanations. Cheers, Shahab