This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/11] Add IA64_MAX_REGISTER_SIZE


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));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]