Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	<qiyao@sourceware.org>
Subject: [patch] provide type_align gdbarch function for nios2
Date: Sat, 15 Sep 2018 01:47:00 -0000	[thread overview]
Message-ID: <7428fb6b-bd85-f852-41a4-683e4bea16ee@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

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

[-- Attachment #2: gdb-align.patch --]
[-- Type: text/x-patch, Size: 1676 bytes --]

commit e05f7a65e4cefcd706b79b07b3941a9c6130c01a
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Fri Sep 14 18:33:56 2018 -0700

    Provide type_align gdbarch function for nios2.
    
    2018-09-14  Sandra Loosemore  <sandra@codesourcery.com>
    
    	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  <sandra@codesourcery.com>
+
+	* nios2-tdep.c (nios2_type_align): New.
+	(nios2_gdb_arch_init): Install type_align hook.
+
 2018-09-10  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* 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<ULONGEST> (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);
 

             reply	other threads:[~2018-09-15  1:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-15  1:47 Sandra Loosemore [this message]
2018-09-15  2:57 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7428fb6b-bd85-f852-41a4-683e4bea16ee@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyao@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox