diff mbox

[3/11] Add MIPS_MAX_REGISTER_SIZE (4/4)

Message ID 0150DDF9-6204-4F4F-99E9-D757C1DBD512@arm.com
State New
Headers show

Commit Message

Alan Hayward May 5, 2017, 8:04 a.m. UTC
> On 11 Apr 2017, at 16:37, Yao Qi <qiyaoltc@gmail.com> wrote:
> 
> Alan Hayward <Alan.Hayward@arm.com> writes:
> 
> Hi Alan,
> There are different ways of getting rid of MAX_REGISTER_SIZE, let us try
> some simple approaches first.  Some uses of MAX_REGISTER_SIZE still
> can't be removed, but let us start from easy part.


Patch split into multiple parts.

In this part mips_eabi_push_dummy_call is extracting an address from the
register. I've hardcoded the buffer to the max address size and added an
assert. I've used the value 8, let me know if there is a #define to use.

Tested on a --enable-targets=all build using make check with board files
unix and native-gdbserver.
I do not have a MIPS machine to test on.

Ok to commit?

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

	* mips-tdep.c (mips_eabi_push_dummy_call): Hard code buffer size.
diff mbox

Patch

diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 7b247eac40e26599b80cd45187417282d03dcc85..145ac7fdc9b5335ff527c5c5c0ede8dc981c5880 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -4528,7 +4528,7 @@  mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   for (argnum = 0; argnum < nargs; argnum++)
     {
       const gdb_byte *val;
-      gdb_byte valbuf[MAX_REGISTER_SIZE];
+      gdb_byte valbuf[8];
       struct value *arg = args[argnum];
       struct type *arg_type = check_typedef (value_type (arg));
       int len = TYPE_LENGTH (arg_type);
@@ -4544,6 +4544,7 @@  mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       if (len > regsize
 	  && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
 	{
+	  gdb_assert (regsize <= 8);
 	  store_unsigned_integer (valbuf, regsize, byte_order,
 				  value_address (arg));
 	  typecode = TYPE_CODE_PTR;