Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alan Hayward <Alan.Hayward@arm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: nd <nd@arm.com>
Subject: [PATCH 2/11] Add IA64_MAX_REGISTER_SIZE
Date: Tue, 04 Apr 2017 10:12:00 -0000	[thread overview]
Message-ID: <B65C3EF7-3E91-4044-83A1-DD681C5422DF@arm.com> (raw)

Max size set to 128bits, which I determined using regformats/reg-ia64.dat

Tested on a --enable-targets=all build using make check with board files
unix and native-gdbserver.

I do not have an IA64 machine to test on.

Ok to commit?

Alan.


2017-04-04  Alan Hayward  <alan.hayward@arm.com>

	* ia64-tdep.c (ia64_register_to_value): Use IA64_MAX_REGISTER_SIZE
	(ia64_value_to_register): Likewise.
	(examine_prologue): Likewise.
	(ia64_sigtramp_frame_prev_register): Likewise.
	(ia64_access_reg): Likewise.
	(ia64_access_rse_reg): Likewise.
	(ia64_libunwind_frame_prev_register): Likewise.
	(ia64_extract_return_value): Likewise.
	(ia64_store_return_value): Likewise.
	(ia64_push_dummy_call): Likewise.
	* ia64-tdep.h: Add IA64_MAX_REGISTER_SIZE


diff --git a/gdb/ia64-tdep.h b/gdb/ia64-tdep.h
index a9a55ab00f1030f1a081a8afa8fc6061f9fb1d12..18c03c5b3cb72cd20e1bb091f82763b3c351873b 100644
--- a/gdb/ia64-tdep.h
+++ b/gdb/ia64-tdep.h
@@ -199,6 +199,9 @@
 #define IA64_NAT32_REGNUM	(IA64_NAT0_REGNUM + 32)
 #define IA64_NAT127_REGNUM	(IA64_NAT0_REGNUM + 127)

+/* Big enough to hold the size of the largest register in bytes.  */
+#define IA64_MAX_REGISTER_SIZE	16
+
 struct frame_info;
 struct regcache;

diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 4c53bc6b05a011e4995c94b669b4f11108a12a38..031c4548968304bc749e6ca957d561a4af2256d5 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -1227,7 +1227,7 @@ ia64_register_to_value (struct frame_info *frame, int regnum,
 			int *optimizedp, int *unavailablep)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
-  gdb_byte in[MAX_REGISTER_SIZE];
+  gdb_byte in[IA64_MAX_REGISTER_SIZE];

   /* Convert to TYPE.  */
   if (!get_frame_register_bytes (frame, regnum, 0,
@@ -1245,7 +1245,7 @@ ia64_value_to_register (struct frame_info *frame, int regnum,
                          struct type *valtype, const gdb_byte *in)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
-  gdb_byte out[MAX_REGISTER_SIZE];
+  gdb_byte out[IA64_MAX_REGISTER_SIZE];
   convert_typed_floating (in, valtype, out, ia64_ext_type (gdbarch));
   put_frame_register (frame, regnum, out);
 }
@@ -1516,7 +1516,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
 	  else if (qp == 0 && rN == 2
 	        && ((rM == fp_reg && fp_reg != 0) || rM == 12))
 	    {
-	      gdb_byte buf[MAX_REGISTER_SIZE];
+	      gdb_byte buf[IA64_MAX_REGISTER_SIZE];
 	      CORE_ADDR saved_sp = 0;
 	      /* adds r2, spilloffset, rFramePointer
 	           or
@@ -2289,7 +2289,7 @@ static struct value *
 ia64_sigtramp_frame_prev_register (struct frame_info *this_frame,
 				   void **this_cache, int regnum)
 {
-  gdb_byte buf[MAX_REGISTER_SIZE];
+  gdb_byte buf[IA64_MAX_REGISTER_SIZE];

   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2495,7 +2495,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   long new_sof, old_sof;
-  gdb_byte buf[MAX_REGISTER_SIZE];
+  gdb_byte buf[IA64_MAX_REGISTER_SIZE];

   /* We never call any libunwind routines that need to write registers.  */
   gdb_assert (!write);
@@ -2575,7 +2575,7 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum,
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   long new_sof, old_sof;
-  gdb_byte buf[MAX_REGISTER_SIZE];
+  gdb_byte buf[IA64_MAX_REGISTER_SIZE];

   /* We never call any libunwind routines that need to write registers.  */
   gdb_assert (!write);
@@ -2982,7 +2982,7 @@ ia64_libunwind_frame_prev_register (struct frame_info *this_frame,
 	{
 	  int rrb_pr = 0;
 	  ULONGEST cfm;
-	  gdb_byte buf[MAX_REGISTER_SIZE];
+	  gdb_byte buf[IA64_MAX_REGISTER_SIZE];

 	  /* Fetch predicate register rename base from current frame
 	     marker for this frame.  */
@@ -3229,7 +3229,7 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
   float_elt_type = is_float_or_hfa_type (type);
   if (float_elt_type != NULL)
     {
-      gdb_byte from[MAX_REGISTER_SIZE];
+      gdb_byte from[IA64_MAX_REGISTER_SIZE];
       int offset = 0;
       int regnum = IA64_FR8_REGNUM;
       int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
@@ -3294,7 +3294,7 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
   float_elt_type = is_float_or_hfa_type (type);
   if (float_elt_type != NULL)
     {
-      gdb_byte to[MAX_REGISTER_SIZE];
+      gdb_byte to[IA64_MAX_REGISTER_SIZE];
       int offset = 0;
       int regnum = IA64_FR8_REGNUM;
       int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
@@ -3856,7 +3856,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	  len = TYPE_LENGTH (type);
 	  while (len > 0 && floatreg < IA64_FR16_REGNUM)
 	    {
-	      gdb_byte to[MAX_REGISTER_SIZE];
+	      gdb_byte to[IA64_MAX_REGISTER_SIZE];
 	      convert_typed_floating (value_contents (arg) + argoffset,
 				      float_elt_type, to,
 				      ia64_ext_type (gdbarch));


             reply	other threads:[~2017-04-04 10:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 10:12 Alan Hayward [this message]
2017-04-05 10:00 ` Yao Qi
2017-04-11 12:47   ` Alan Hayward
2017-04-11 17:17     ` Yao Qi
2017-04-12 13:41       ` Alan Hayward
2017-04-25 16:08         ` Yao Qi
2017-04-26 10:38           ` Alan Hayward
2017-04-27 10:17             ` Yao Qi
2017-04-27 10:48               ` Alan Hayward
     [not found]                 ` <79E51549-1B65-4DA8-891A-17EF061E03A3@arm.com>
2017-06-06 10:04                   ` Yao Qi
2017-06-06 12:57                     ` Alan Hayward

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=B65C3EF7-3E91-4044-83A1-DD681C5422DF@arm.com \
    --to=alan.hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    /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