From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eUmdA9Ru8GDqUgAAWB0awg (envelope-from ) for ; Thu, 15 Jul 2021 13:22:28 -0400 Received: by simark.ca (Postfix, from userid 112) id 036F71EDF0; Thu, 15 Jul 2021 13:22:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FSL_HELO_FAKE,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A45D21E54D for ; Thu, 15 Jul 2021 13:22:27 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F4E73989C2F for ; Thu, 15 Jul 2021 17:22:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F4E73989C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626369747; bh=3dh/UxzdbFO7M+LjyWSAOCaqbyrf0DulRKhnpWzxTOk=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hSXspNLBNjXuqDCeGtamTB+dBP8BYL3uAoBGXBLG5o/ltFbuiiBDWZ5nF9x0iDU1J USM8SvTIu0eniI4P6h1knh6zHpK0R3F1zIU71VpNiZytlEQgM/e1DxIej7hw//SOKr 9JpZL2K9V4zl+91lV7vali16LNHEJpjfndaBYSjc= 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 To: Simon Marchi 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-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: , From: Shahab Vahedi via Gdb Reply-To: Shahab Vahedi Cc: gdb@sourceware.org Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" 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