public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
@ 2017-04-04 10:16 Alan Hayward
  2017-04-05 10:23 ` Yao Qi
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Hayward @ 2017-04-04 10:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd

Max size set to 128bits, which I determined using xtensa_register_type()

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

I do not have a XTENSA machine to test on.

Ok to commit?

Alan.

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

	* xtensa-tdep.c (xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
	(xtensa_register_read_masked): Likewise.
	(xtensa_pseudo_register_read): Likewise.
	(xtensa_pseudo_register_write): Likewise.
	* xtensa-tdep.h (XTENSA_MAX_REGISTER_SIZE): Add.



diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 46aeecb35567930ac1497df3dae09d5ffe57e9e1..39abe1f8acb8fc508f48c7cf5bd81366e5f584be 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -222,6 +222,9 @@ struct gdbarch_tdep
   struct ctype_cache *type_entries;
 };

+/* Big enough to hold the size of the largest register in bytes.  */
+#define XTENSA_MAX_REGISTER_SIZE	16
+
 /* Macro to instantiate a gdbarch_tdep structure.  */

 #define XTENSA_GDBARCH_TDEP_INSTANTIATE(rmap,spillsz)			\
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 376f4c7340c3292273d5b0912b23ff7166382e8b..655f884926dfad88cb03b582f608788c049d3bad 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -370,7 +370,7 @@ static void
 xtensa_register_write_masked (struct regcache *regcache,
 			      xtensa_register_t *reg, const gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;		/* Shift for next mask (mod 32).  */
@@ -454,7 +454,7 @@ static enum register_status
 xtensa_register_read_masked (struct regcache *regcache,
 			     xtensa_register_t *reg, gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;
@@ -559,7 +559,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
-      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);
       enum register_status status;

       status = regcache_raw_read (regcache,
@@ -655,7 +655,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
-      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);

       regcache_raw_read (regcache,
 			 gdbarch_tdep (gdbarch)->wb_regnum, buf);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-04-04 10:16 [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE Alan Hayward
@ 2017-04-05 10:23 ` Yao Qi
  2017-04-06 12:49   ` Alan Hayward
  0 siblings, 1 reply; 9+ messages in thread
From: Yao Qi @ 2017-04-05 10:23 UTC (permalink / raw)
  To: Alan Hayward; +Cc: gdb-patches, nd

Alan Hayward <Alan.Hayward@arm.com> writes:

> @@ -559,7 +559,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
>        && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>        && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>      {
> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
> +      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);
>        enum register_status status;
>
>        status = regcache_raw_read (regcache,
> @@ -655,7 +655,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
>        && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>        && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>      {
> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
> +      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);
>
>        regcache_raw_read (regcache,
>  			 gdbarch_tdep (gdbarch)->wb_regnum, buf);

The "buf" can be removed by using regcache_raw_read_unsigned.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-04-05 10:23 ` Yao Qi
@ 2017-04-06 12:49   ` Alan Hayward
  2017-04-25 15:39     ` Yao Qi
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Hayward @ 2017-04-06 12:49 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, nd


> On 5 Apr 2017, at 11:23, Yao Qi <qiyaoltc@gmail.com> wrote:
> 
> Alan Hayward <Alan.Hayward@arm.com> writes:
> 
>> @@ -559,7 +559,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
>>       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>>       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>>     {
>> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
>> +      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);
>>       enum register_status status;
>> 
>>       status = regcache_raw_read (regcache,
>> @@ -655,7 +655,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
>>       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>>       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>>     {
>> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
>> +      gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE);
>> 
>>       regcache_raw_read (regcache,
>> 			 gdbarch_tdep (gdbarch)->wb_regnum, buf);
> 
> The "buf" can be removed by using regcache_raw_read_unsigned.
> 
> -- 
> Yao (齐尧)

Ok, the patch below makes that change.

I want to make it clear that I do not have an xtensa machine.
With the previous patch I was confident that it would not cause any
regressions - as it only switched the define being used, and
shouldn't cause any functional change.

With the new patch there is more untested code and I am less confident
that I've not introduced a subtle error.

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

Ok to commit (or the previous version?

Alan.

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

	* xtensa-tdep.c (XTENSA_MAX_REGISTER_SIZE): Add.
	(xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
	(xtensa_register_read_masked): Likewise.
	(xtensa_pseudo_register_read): Use regcache_raw_read_unsigned.
	(xtensa_pseudo_register_write): Likewise.

diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 13f1514e7651e47a268ef809b1324167f1f759bd..53c866075841fb00170cc34e446d6fc21c869032 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -120,6 +120,9 @@ static unsigned int xtensa_debug_level = 0;
 #define PS_WOE			(1<<18)
 #define PS_EXC			(1<<4)

+/* Big enough to hold the size of the largest register in bytes.  */
+#define XTENSA_MAX_REGISTER_SIZE	16
+
 static int
 windowing_enabled (struct gdbarch *gdbarch, unsigned int ps)
 {
@@ -370,7 +373,7 @@ static void
 xtensa_register_write_masked (struct regcache *regcache,
 			      xtensa_register_t *reg, const gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;		/* Shift for next mask (mod 32).  */
@@ -454,7 +457,7 @@ static enum register_status
 xtensa_register_read_masked (struct regcache *regcache,
 			     xtensa_register_t *reg, gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;
@@ -559,16 +562,15 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
-      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+      ULONGEST value;
       enum register_status status;

-      status = regcache_raw_read (regcache,
-				  gdbarch_tdep (gdbarch)->wb_regnum,
-				  buf);
+      status = regcache_raw_read_unsigned (regcache,
+					   gdbarch_tdep (gdbarch)->wb_regnum,
+					   &value);
       if (status != REG_VALID)
 	return status;
-      regnum = arreg_number (gdbarch, regnum,
-			     extract_unsigned_integer (buf, 4, byte_order));
+      regnum = arreg_number (gdbarch, regnum, value);
     }

   /* We can always read non-pseudo registers.  */
@@ -656,12 +658,10 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
-      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
-
-      regcache_raw_read (regcache,
-			 gdbarch_tdep (gdbarch)->wb_regnum, buf);
-      regnum = arreg_number (gdbarch, regnum,
-			     extract_unsigned_integer (buf, 4, byte_order));
+      ULONGEST value;
+      regcache_raw_read_unsigned (regcache,
+				  gdbarch_tdep (gdbarch)->wb_regnum, &value);
+      regnum = arreg_number (gdbarch, regnum, value);
     }

   /* We can always write 'core' registers.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-04-06 12:49   ` Alan Hayward
@ 2017-04-25 15:39     ` Yao Qi
  2017-04-26  9:59       ` Alan Hayward
  0 siblings, 1 reply; 9+ messages in thread
From: Yao Qi @ 2017-04-25 15:39 UTC (permalink / raw)
  To: Alan Hayward; +Cc: gdb-patches

Alan Hayward <Alan.Hayward@arm.com> writes:

> @@ -559,16 +562,15 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
>        && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>        && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>      {
> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
> +      ULONGEST value;
>        enum register_status status;
>
> -      status = regcache_raw_read (regcache,
> -				  gdbarch_tdep (gdbarch)->wb_regnum,
> -				  buf);
> +      status = regcache_raw_read_unsigned (regcache,
> +					   gdbarch_tdep (gdbarch)->wb_regnum,
> +					   &value);
>        if (status != REG_VALID)
>  	return status;
> -      regnum = arreg_number (gdbarch, regnum,
> -			     extract_unsigned_integer (buf, 4, byte_order));
> +      regnum = arreg_number (gdbarch, regnum, value);
>      }
>
>    /* We can always read non-pseudo registers.  */
> @@ -656,12 +658,10 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
>        && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>        && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>      {
> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
> -
> -      regcache_raw_read (regcache,
> -			 gdbarch_tdep (gdbarch)->wb_regnum, buf);
> -      regnum = arreg_number (gdbarch, regnum,
> -			     extract_unsigned_integer (buf, 4, byte_order));
> +      ULONGEST value;
> +      regcache_raw_read_unsigned (regcache,
> +				  gdbarch_tdep (gdbarch)->wb_regnum, &value);
> +      regnum = arreg_number (gdbarch, regnum, value);

This part of patch is OK, but the part using XTENSA_MAX_REGISTER_SIZE
still needs some review.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-04-25 15:39     ` Yao Qi
@ 2017-04-26  9:59       ` Alan Hayward
  2017-06-08  9:42         ` Alan Hayward
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Hayward @ 2017-04-26  9:59 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, nd


> On 25 Apr 2017, at 16:39, Yao Qi <qiyaoltc@gmail.com> wrote:
> 
> Alan Hayward <Alan.Hayward@arm.com> writes:
> 
>> @@ -559,16 +562,15 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
>>       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>>       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>>     {
>> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
>> +      ULONGEST value;
>>       enum register_status status;
>> 
>> -      status = regcache_raw_read (regcache,
>> -				  gdbarch_tdep (gdbarch)->wb_regnum,
>> -				  buf);
>> +      status = regcache_raw_read_unsigned (regcache,
>> +					   gdbarch_tdep (gdbarch)->wb_regnum,
>> +					   &value);
>>       if (status != REG_VALID)
>> 	return status;
>> -      regnum = arreg_number (gdbarch, regnum,
>> -			     extract_unsigned_integer (buf, 4, byte_order));
>> +      regnum = arreg_number (gdbarch, regnum, value);
>>     }
>> 
>>   /* We can always read non-pseudo registers.  */
>> @@ -656,12 +658,10 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
>>       && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
>>       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
>>     {
>> -      gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
>> -
>> -      regcache_raw_read (regcache,
>> -			 gdbarch_tdep (gdbarch)->wb_regnum, buf);
>> -      regnum = arreg_number (gdbarch, regnum,
>> -			     extract_unsigned_integer (buf, 4, byte_order));
>> +      ULONGEST value;
>> +      regcache_raw_read_unsigned (regcache,
>> +				  gdbarch_tdep (gdbarch)->wb_regnum, &value);
>> +      regnum = arreg_number (gdbarch, regnum, value);
> 
> This part of patch is OK, but the part using XTENSA_MAX_REGISTER_SIZE
> still needs some review.
> 
> -- 
> Yao (齐尧)


Ok, Above committed with:

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

	* xtensa-tdep.c (xtensa_pseudo_register_read): Use
	regcache_raw_read_unsigned.
	(xtensa_pseudo_register_write): Likewise.


This leaves the following left to review (below).

Looking at the code, I'm still a little unsure exactly how "value" is
being used. "value" is declared as max register size, rounded up to the
next int. Looking at the use of value, I think the code requires max
size of a register multiplied by the value in reg->mask + 1 - and checking
xtensa-config.c, this never goes above one. The comment also states
the size of a masked register is never greater than 32bits.
Maybe the value should be given a size of 32bits * (mask->count + 1) ?


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

	* xtensa-tdep.c (XTENSA_MAX_REGISTER_SIZE): Add.
        (xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
	(xtensa_register_read_masked): Likewise.


diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 0a4ed37cf9582a7aa43ec601fc013f1f93624a39..e79c925b345a8bd03e3a674c731c00e86f1ea39a 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -120,6 +120,9 @@ static unsigned int xtensa_debug_level = 0;
 #define PS_WOE			(1<<18)
 #define PS_EXC			(1<<4)

+/* Big enough to hold the size of the largest register in bytes.  */
+#define XTENSA_MAX_REGISTER_SIZE	16
+
 static int
 windowing_enabled (struct gdbarch *gdbarch, unsigned int ps)
 {
@@ -370,7 +373,7 @@ static void
 xtensa_register_write_masked (struct regcache *regcache,
 			      xtensa_register_t *reg, const gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;		/* Shift for next mask (mod 32).  */
@@ -454,7 +457,7 @@ static enum register_status
 xtensa_register_read_masked (struct regcache *regcache,
 			     xtensa_register_t *reg, gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-04-26  9:59       ` Alan Hayward
@ 2017-06-08  9:42         ` Alan Hayward
  2017-06-12  9:54           ` Yao Qi
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Hayward @ 2017-06-08  9:42 UTC (permalink / raw)
  To: Yao Qi, gdb-patches; +Cc: nd


> On 26 Apr 2017, at 10:59, Alan Hayward <Alan.Hayward@arm.com> wrote:
> 
> 
>> On 25 Apr 2017, at 16:39, Yao Qi <qiyaoltc@gmail.com> wrote:
>> 
>> Alan Hayward <Alan.Hayward@arm.com> writes:
>> 

I’ve rebased this patch due to Yao’s unit test changes.
XTENSA_MAX_REGISTER_SIZE is set to 64 to ensure nothing breaks.


I don't have a XTENSA machine to test on.
Tested on a --enable-targets=all and asan build using
make check with board files unix, native-gdbserver and unittest

Ok to commit?

Alan.

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

	* xtensa-tdep.c (XTENSA_MAX_REGISTER_SIZE): Add.
	(xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
	(xtensa_register_read_masked): Likewise.


diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index f9e858473a409ff082d30f9ff474d48da63903e3..f875f20d32b68abc37e3db37ab3e6053918536e5 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -120,6 +120,9 @@ static unsigned int xtensa_debug_level = 0;
 #define PS_WOE			(1<<18)
 #define PS_EXC			(1<<4)

+/* Big enough to hold the size of the largest register in bytes.  */
+#define XTENSA_MAX_REGISTER_SIZE	64
+
 static int
 windowing_enabled (struct gdbarch *gdbarch, unsigned int ps)
 {
@@ -370,7 +373,7 @@ static void
 xtensa_register_write_masked (struct regcache *regcache,
 			      xtensa_register_t *reg, const gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;		/* Shift for next mask (mod 32).  */
@@ -454,7 +457,7 @@ static enum register_status
 xtensa_register_read_masked (struct regcache *regcache,
 			     xtensa_register_t *reg, gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-06-08  9:42         ` Alan Hayward
@ 2017-06-12  9:54           ` Yao Qi
  2017-06-21  9:36             ` Alan Hayward
  0 siblings, 1 reply; 9+ messages in thread
From: Yao Qi @ 2017-06-12  9:54 UTC (permalink / raw)
  To: Alan Hayward, maxim2405; +Cc: gdb-patches, nd

Alan Hayward <Alan.Hayward@arm.com> writes:

> I don't have a XTENSA machine to test on.
> Tested on a --enable-targets=all and asan build using
> make check with board files unix, native-gdbserver and unittest
>
> Ok to commit?
>
> Alan.
>
> 2017-06-08  Alan Hayward  <alan.hayward@arm.com>
>
> 	* xtensa-tdep.c (XTENSA_MAX_REGISTER_SIZE): Add.
> 	(xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
> 	(xtensa_register_read_masked): Likewise.

Hi Maxim,
What do you think about this patch?

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-06-12  9:54           ` Yao Qi
@ 2017-06-21  9:36             ` Alan Hayward
  2017-06-22 16:40               ` Max Filippov
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Hayward @ 2017-06-21  9:36 UTC (permalink / raw)
  To: Yao Qi, jcmvbkbc, larue; +Cc: maxim2405, gdb-patches, nd

Adding Woody and Max, the xtensa maintainers.
Patch is to remove uses of MAX_REGISTER_SIZE in xtensa-tdep.c
Re-pasted patch to end of email for convenience.


> On 12 Jun 2017, at 10:54, Yao Qi <qiyaoltc@gmail.com> wrote:
> 
> Alan Hayward <Alan.Hayward@arm.com> writes:
> 
>> I don't have a XTENSA machine to test on.
>> Tested on a --enable-targets=all and asan build using
>> make check with board files unix, native-gdbserver and unittest
>> 
>> Ok to commit?
>> 
>> Alan.
>> 
>> 2017-06-08  Alan Hayward  <alan.hayward@arm.com>
>> 
>> 	* xtensa-tdep.c (XTENSA_MAX_REGISTER_SIZE): Add.
>> 	(xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
>> 	(xtensa_register_read_masked): Likewise.
> 
> Hi Maxim,
> What do you think about this patch?
> 
> -- 
> Yao (齐尧)


diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index f9e858473a409ff082d30f9ff474d48da63903e3..f875f20d32b68abc37e3db37ab3e6053918536e5 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -120,6 +120,9 @@ static unsigned int xtensa_debug_level = 0;
 #define PS_WOE			(1<<18)
 #define PS_EXC			(1<<4)

+/* Big enough to hold the size of the largest register in bytes.  */
+#define XTENSA_MAX_REGISTER_SIZE	64
+
 static int
 windowing_enabled (struct gdbarch *gdbarch, unsigned int ps)
 {
@@ -370,7 +373,7 @@ static void
 xtensa_register_write_masked (struct regcache *regcache,
 			      xtensa_register_t *reg, const gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;		/* Shift for next mask (mod 32).  */
@@ -454,7 +457,7 @@ static enum register_status
 xtensa_register_read_masked (struct regcache *regcache,
 			     xtensa_register_t *reg, gdb_byte *buffer)
 {
-  unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+  unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
   const xtensa_mask_t *mask = reg->mask;

   int shift = 0;



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE
  2017-06-21  9:36             ` Alan Hayward
@ 2017-06-22 16:40               ` Max Filippov
  0 siblings, 0 replies; 9+ messages in thread
From: Max Filippov @ 2017-06-22 16:40 UTC (permalink / raw)
  To: Alan Hayward; +Cc: Yao Qi, larue, maxim2405, gdb-patches, nd

Hi Alan,

On Wed, Jun 21, 2017 at 2:35 AM, Alan Hayward <Alan.Hayward@arm.com> wrote:
> Adding Woody and Max, the xtensa maintainers.
> Patch is to remove uses of MAX_REGISTER_SIZE in xtensa-tdep.c
> Re-pasted patch to end of email for convenience.

the change looks good to me.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-06-22 16:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 10:16 [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE Alan Hayward
2017-04-05 10:23 ` Yao Qi
2017-04-06 12:49   ` Alan Hayward
2017-04-25 15:39     ` Yao Qi
2017-04-26  9:59       ` Alan Hayward
2017-06-08  9:42         ` Alan Hayward
2017-06-12  9:54           ` Yao Qi
2017-06-21  9:36             ` Alan Hayward
2017-06-22 16:40               ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).