diff mbox

[1/11] Add ARM_MAX_REGISTER_SIZE

Message ID D7BDA6FD-6E9B-446A-A000-13546214C5DB@arm.com
State New
Headers show

Commit Message

Alan Hayward April 4, 2017, 10:11 a.m. UTC
Max size set to 96bits, which is taken from FP_REGISTER_SIZE

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

Ok to commit?

Alan.


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

	* arm-tdep.c (arm_store_return_value): Use ARM_MAX_REGISTER_SIZE.
	* arm-tdep.h: Add ARM_MAX_REGISTER_SIZE.

Comments

Yao Qi April 5, 2017, 9:30 a.m. UTC | #1
On Tue, Apr 4, 2017 at 11:11 AM, Alan Hayward <Alan.Hayward@arm.com> wrote:
> Max size set to 96bits, which is taken from FP_REGISTER_SIZE
>

> @@ -8153,7 +8153,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
>
>    if (TYPE_CODE (type) == TYPE_CODE_FLT)
>      {
> -      gdb_byte buf[MAX_REGISTER_SIZE];
> +      gdb_byte buf[ARM_MAX_REGISTER_SIZE];
>
>        switch (gdbarch_tdep (gdbarch)->fp_model)
>         {
>

"buf" is only used for PFA register, and its size is FP_REGISTER_SIZE
so why don't we do "buf[FP_REGISTER_SIZE]?

@@ -8160,11 +8177,10 @@ arm_store_return_value (struct type *type,
struct regcache *regs, like this,

   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     {
-      gdb_byte buf[MAX_REGISTER_SIZE];
-
       switch (gdbarch_tdep (gdbarch)->fp_model)
        {
        case ARM_FLOAT_FPA:
+         gdb_byte buf[FP_REGISTER_SIZE];

          convert_to_extended (floatformat_from_type (type), buf, valbuf,
                               gdbarch_byte_order (gdbarch));
Alan Hayward April 5, 2017, 1:20 p.m. UTC | #2
> On 5 Apr 2017, at 10:30, Yao Qi <qiyaoltc@gmail.com> wrote:

> 

> On Tue, Apr 4, 2017 at 11:11 AM, Alan Hayward <Alan.Hayward@arm.com> wrote:

>> Max size set to 96bits, which is taken from FP_REGISTER_SIZE

>> 

> 

>> @@ -8153,7 +8153,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,

>> 

>>   if (TYPE_CODE (type) == TYPE_CODE_FLT)

>>     {

>> -      gdb_byte buf[MAX_REGISTER_SIZE];

>> +      gdb_byte buf[ARM_MAX_REGISTER_SIZE];

>> 

>>       switch (gdbarch_tdep (gdbarch)->fp_model)

>>        {

>> 

> 

> "buf" is only used for PFA register, and its size is FP_REGISTER_SIZE

> so why don't we do "buf[FP_REGISTER_SIZE]?

> 

> @@ -8160,11 +8177,10 @@ arm_store_return_value (struct type *type,

> struct regcache *regs, like this,

> 

>   if (TYPE_CODE (type) == TYPE_CODE_FLT)

>     {

> -      gdb_byte buf[MAX_REGISTER_SIZE];

> -

>       switch (gdbarch_tdep (gdbarch)->fp_model)

>        {

>        case ARM_FLOAT_FPA:

> +         gdb_byte buf[FP_REGISTER_SIZE];

> 

>          convert_to_extended (floatformat_from_type (type), buf, valbuf,

>                               gdbarch_byte_order (gdbarch));

> -- 

> Yao (齐尧)


Yes, that makes sense to me.
(Aarch64-tdep.c will have the same change when I do that one).


Alan.
diff mbox

Patch

diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index 8125226362e5a9c155b60ffd1fbd4ed839270493..20bcda9dcc554c7d613d6534f5b3cf9a59dfa975 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -38,6 +38,9 @@  struct gdb_get_next_pcs;
    purposes and code readability.  These are fixed at 64 bits.  */
 #define VFP_REGISTER_SIZE	8

+/* Big enough to hold the size of the largest register in bytes.  */
+#define ARM_MAX_REGISTER_SIZE	FP_REGISTER_SIZE
+
 /* Number of machine registers.  The only define actually required
    is gdbarch_num_regs.  The other definitions are used for documentation
    purposes and code readability.  */
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 88ed391729813dc4ef8e4dccb6698fa798e0de08..6b544481627678f2b6442725573b02d4e4cd9f2d 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8153,7 +8153,7 @@  arm_store_return_value (struct type *type, struct regcache *regs,

   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     {
-      gdb_byte buf[MAX_REGISTER_SIZE];
+      gdb_byte buf[ARM_MAX_REGISTER_SIZE];

       switch (gdbarch_tdep (gdbarch)->fp_model)
 	{