From patchwork Sun Feb 17 12:47:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 31492 Received: (qmail 123774 invoked by alias); 17 Feb 2019 12:47:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 123757 invoked by uid 89); 17 Feb 2019 12:47:17 -0000 Authentication-Results: sourceware.org; auth=none 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, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=visium, H*f:sk:87wom56, evaluated, H*f:sk:87ftss7 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Feb 2019 12:47:16 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 50CA656057; Sun, 17 Feb 2019 07:47:14 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YaoVXy7+y1RN; Sun, 17 Feb 2019 07:47:14 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E626356055; Sun, 17 Feb 2019 07:47:12 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 22A7E838C7; Sun, 17 Feb 2019 16:47:08 +0400 (+04) Date: Sun, 17 Feb 2019 16:47:08 +0400 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org, Andrew Burgess Subject: Re: [RFA] (riscv/ada) fix error when calling functions with range argument Message-ID: <20190217124708.GA25164@adacore.com> References: <1549805906-1627-1-git-send-email-brobecker@adacore.com> <87wom56j7u.fsf@tromey.com> <87ftss7ll9.fsf@tromey.com> <20190214032254.GB2945@adacore.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190214032254.GB2945@adacore.com> User-Agent: Mutt/1.9.4 (2018-02-28) > > Tom> I don't have any issue with this, but I do wonder if > > Tom> riscv_type_alignment can be removed and/or simplified in favor > > Tom> type_align and the gdbarch method. > > > > Also now I wonder whether the TYPE_CODE_RANGE case in > > gdbtypes.c:type_align ought to be changed. Right now it just returns 0, > > which means "cannot be determined". > > Makes sense to me. I don't see this as being any problem at all, but > just in case, Let's make the change internally at AdaCore, and > have it be evaluated on all our platforms. Attached is a patch which does just that. gdb/ChangeLog: * gdbtypes.c (type_align): Handle TYPE_CODE_RANGE the same as integers and enumeration types. Tested on x86_64-linux. Also tested on a variety of platforms (with CPUs being ARM, AArch64, Leon3 (SPARC-like), PowerPC, PowerPC64, RV64, Visium, x86, x86_64). OK to push? From c6cec5f43eefc87120ae148fc3edf695a345438d Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Sun, 17 Feb 2019 07:40:43 -0500 Subject: [PATCH] type_align: handle range types the same as ints and enums This commit enhances type_align to handle TYPE_CODE_RANGE types the same as integers and enums, rather than returning zero, which means for this function that it could not determine its alignment. gdb/ChangeLog: * gdbtypes.c (type_align): Handle TYPE_CODE_RANGE the same as integers and enumeration types. Tested on x86_64-linux. Also tested on a variety of platforms (with CPUs being ARM, AArch64, Leon3 (SPARC-like), PowerPC, PowerPC64, RV64, Visium, x86, x86_64). --- gdb/gdbtypes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d1ca304..6758783 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3003,6 +3003,7 @@ type_align (struct type *type) case TYPE_CODE_FUNC: case TYPE_CODE_FLAGS: case TYPE_CODE_INT: + case TYPE_CODE_RANGE: case TYPE_CODE_FLT: case TYPE_CODE_ENUM: case TYPE_CODE_REF: @@ -3047,7 +3048,6 @@ type_align (struct type *type) break; case TYPE_CODE_SET: - case TYPE_CODE_RANGE: case TYPE_CODE_STRING: /* Not sure what to do here, and these can't appear in C or C++ anyway. */ -- 2.1.4