From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90626 invoked by alias); 14 Jun 2018 22:28:02 -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 90573 invoked by uid 89); 14 Jun 2018 22:28:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=online X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Jun 2018 22:28:00 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w5EMRoTk011468 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Jun 2018 18:27:55 -0400 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id C7E081E529; Thu, 14 Jun 2018 18:27:50 -0400 (EDT) Subject: Re: [PATCH] default_type_align: Use type_length_units To: Tom Tromey Cc: Simon Marchi , gdb-patches@sourceware.org References: <1528928623-27479-1-git-send-email-simon.marchi@ericsson.com> <877en1e23t.fsf@tromey.com> <87y3fhcflw.fsf@tromey.com> From: Simon Marchi Message-ID: Date: Thu, 14 Jun 2018 22:28:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <87y3fhcflw.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 14 Jun 2018 22:27:51 +0000 X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00380.txt.bz2 On 2018-06-14 03:50 PM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> This use seems related to C++, and our compiler is C only, so I can't > Simon> test that. But it would make sense, I can include that change if you > Simon> prefer. > > Yeah, I think it would be best to either change both or change neither > (and update the comment). Here's what I pushed. However, I parsed the "and update the comment" of your reply after pushing. Which comment did you want me to update? Simon >From 55c748a1c01f33cec0f762969db1bae457e8bcca Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 14 Jun 2018 18:23:39 -0400 Subject: [PATCH] type alignment: Use type_length_units The type alignment value is returned in 8-bit-bytes instead of target memory addressable units. For example, on a target with 16-bit-bytes where sizeof(int) == 1 (one addressable unit), alignof(int) currently returns 2. After, this patch, it returns 1. gdb/ChangeLog: * arch-utils.c (default_type_align): Use type_length_units. * gdbtypes.c (type_align): Use type_length_units. --- gdb/ChangeLog | 5 +++++ gdb/arch-utils.c | 2 +- gdb/gdbtypes.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 60766ca77758..aba9a1a1b1f3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-06-14 Simon Marchi + + * arch-utils.c (default_type_align): Use type_length_units. + * gdbtypes.c (type_align): Use type_length_units. + 2018-06-14 Philippe Waroquiers * cli/cli-script.c (_initialize_cli_script): Fix online documentation diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 76bc16f37500..a65f01f83368 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -994,7 +994,7 @@ default_in_indirect_branch_thunk (gdbarch *gdbarch, CORE_ADDR pc) ULONGEST default_type_align (struct gdbarch *gdbarch, struct type *type) { - return TYPE_LENGTH (check_typedef (type)); + return type_length_units (check_typedef (type)); } void diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index fdd28c0886e3..65b1211ec492 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3072,7 +3072,7 @@ type_align (struct type *type) case TYPE_CODE_METHODPTR: case TYPE_CODE_MEMBERPTR: - align = TYPE_LENGTH (type); + align = type_length_units (type); break; case TYPE_CODE_VOID: -- 2.17.1