From patchwork Sat Sep 15 01:47:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 29379 Received: (qmail 97564 invoked by alias); 15 Sep 2018 01:47:28 -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 97549 invoked by uid 89); 15 Sep 2018 01:47:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Sandra, sandra, H*r:0700 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 15 Sep 2018 01:47:26 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1g0zgC-0002Gh-Ka from Sandra_Loosemore@mentor.com ; Fri, 14 Sep 2018 18:47:24 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 14 Sep 2018 18:47:22 -0700 To: "gdb-patches@sourceware.org" , From: Sandra Loosemore Subject: [patch] provide type_align gdbarch function for nios2 Message-ID: <7428fb6b-bd85-f852-41a4-683e4bea16ee@codesourcery.com> Date: Fri, 14 Sep 2018 19:47:19 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 The attached patch fixes almost 400 failures in gdb.base/align.exp and related tests due to a missing definition for the type_align hook for nios2. I swiped the definition of the hook from the arc backend which has similar conventions: the alignment of byte/halfword types matches their size, but all types 4 bytes or larger are aligned on a 4-byte boundary. OK to commit? -Sandra commit e05f7a65e4cefcd706b79b07b3941a9c6130c01a Author: Sandra Loosemore Date: Fri Sep 14 18:33:56 2018 -0700 Provide type_align gdbarch function for nios2. 2018-09-14 Sandra Loosemore gdb/ * nios2-tdep.c (nios2_type_align): New. (nios2_gdb_arch_init): Install type_align hook. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4e667b7..6fe0526 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-09-14 Sandra Loosemore + + * nios2-tdep.c (nios2_type_align): New. + (nios2_gdb_arch_init): Install type_align hook. + 2018-09-10 Andrew Burgess * eval.c (fake_method::fake_method): Call xzalloc directly for a diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index c7d5b9f..eb5285a 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -2230,6 +2230,15 @@ nios2_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) return 1; } +/* Implement the type_align gdbarch function. */ + +static ULONGEST +nios2_type_align (struct gdbarch *gdbarch, struct type *type) +{ + type = check_typedef (type); + return std::min (4, TYPE_LENGTH (type)); +} + /* Initialize the Nios II gdbarch. */ static struct gdbarch * @@ -2293,6 +2302,8 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); + set_gdbarch_type_align (gdbarch, nios2_type_align); + set_gdbarch_float_format (gdbarch, floatformats_ieee_single); set_gdbarch_double_format (gdbarch, floatformats_ieee_double);