From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95082 invoked by alias); 14 Jun 2018 16:59:19 -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 95073 invoked by uid 89); 14 Jun 2018 16:59:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=deeply, curious, dw_at_alignment, DW_AT_alignment X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Jun 2018 16:59:17 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 993D2EEB2 for ; Thu, 14 Jun 2018 11:59:16 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id TVaSfYcJxBcCXTVaZfNLTT; Thu, 14 Jun 2018 11:59:16 -0500 X-Authority-Reason: nr=8 Received: from [12.176.89.6] (port=35298 helo=pokyo) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fTVaS-0018sB-6f; Thu, 14 Jun 2018 11:59:04 -0500 From: Tom Tromey To: Simon Marchi Cc: , Tom Tromey Subject: Re: [PATCH] default_type_align: Use type_length_units References: <1528928623-27479-1-git-send-email-simon.marchi@ericsson.com> Date: Thu, 14 Jun 2018 16:59:00 -0000 In-Reply-To: <1528928623-27479-1-git-send-email-simon.marchi@ericsson.com> (Simon Marchi's message of "Wed, 13 Jun 2018 18:23:43 -0400") Message-ID: <877en1e23t.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fTVaS-0018sB-6f X-Source-Sender: (pokyo) [12.176.89.6]:35298 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-06/txt/msg00368.txt.bz2 >>>>> "Simon" == Simon Marchi writes: Simon> The type alignment value is returned in 8-bit-bytes instead of target Simon> memory addressable units. For example, on a target with 16-bit-bytes Simon> where sizeof(int) == 1 (one addressable unit), alignof(int) currently Simon> returns 2. After, this patch, it returns 1. Simon> * arch-utils.c (default_type_align): Use type_length_units. This certainly is correct according to the comment in gdbtypes.h: /* * Return the alignment of the type in target addressable memory units. However, I was curious to know what DWARF specifies, to see whether dwarf2read was doing this as well. But DWARF seems pretty silent on this topic: A debugging information entry may have a DW_AT_alignment attribute whose value of class constant is a positive, non-zero, integer describing the alignment of the entity. So maybe this is depending on what your compiler does? I think I did not really consider this issue too deeply when writing the alignment support :( Another possible issue is that gdbtypes.c:type_align uses TYPE_LENGTH in one spot but I suppose it ought to use type_length_units if this patch goes in. Tom