[9/11] Add MN10300_MAX_REGISTER_SIZE (1)
Commit Message
> On 4 Apr 2017, at 11:15, Alan Hayward <Alan.Hayward@arm.com> wrote:
>
> Max size set to 32bits, which I determined using mn10300_register_type()
>
> Tested on a --enable-targets=all build using make check with board files
> unix and native-gdbserver.
>
> I do not have a MN10300 machine to test on.
>
> Ok to commit?
>
> Alan.
>
Split this into two patches.
This part uses the new raw_supply_zeroed.
Tested on a --enable-targets=all build using make check with board files
unix and native-gdbserver.
I do not have a MN10300 machine to test on.
Ok to commit?
Alan.
2017-05-04 Alan Hayward <alan.hayward@arm.com>
* mn10300-linux-tdep.c (am33_supply_gregset_method): Use
regcache->raw_supply_zeroed.
Comments
Alan Hayward <Alan.Hayward@arm.com> writes:
> diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
> index 8c23f02b2b58b29b10a65df5ae0b4bcdce2925cd..44707e8e241d0fddfb4f1e24821941bf6679b9a3 100644
> --- a/gdb/mn10300-linux-tdep.c
> +++ b/gdb/mn10300-linux-tdep.c
> @@ -86,7 +86,6 @@ am33_supply_gregset_method (const struct regset *regset,
> struct regcache *regcache,
> int regnum, const void *gregs, size_t len)
> {
> - char zerobuf[MAX_REGISTER_SIZE];
> const mn10300_elf_greg_t *regp = (const mn10300_elf_greg_t *) gregs;
> int i;
>
> @@ -188,17 +187,13 @@ am33_supply_gregset_method (const struct regset *regset,
>
> /* ssp, msp, and usp are inaccessible. */
As this comment explained, these registers are inaccessible, so we can
treat them unavailable, then, we just do
regcache_raw_supply (regcache, E_E8_REGNUM, NULL);
but this changes the functionality. I don't know about this
architecture.
> case E_E8_REGNUM:
> - memset (zerobuf, 0, MAX_REGISTER_SIZE);
> - regcache_raw_supply (regcache, E_E8_REGNUM, zerobuf);
> + regcache->raw_supply_zeroed (E_E8_REGNUM);
> break;
Your patch is still good to me, as it doesn't change the functionality.
@@ -86,7 +86,6 @@ am33_supply_gregset_method (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
- char zerobuf[MAX_REGISTER_SIZE];
const mn10300_elf_greg_t *regp = (const mn10300_elf_greg_t *) gregs;
int i;
@@ -188,17 +187,13 @@ am33_supply_gregset_method (const struct regset *regset,
/* ssp, msp, and usp are inaccessible. */
case E_E8_REGNUM:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
- regcache_raw_supply (regcache, E_E8_REGNUM, zerobuf);
+ regcache->raw_supply_zeroed (E_E8_REGNUM);
break;
case E_E9_REGNUM:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
- regcache_raw_supply (regcache, E_E9_REGNUM, zerobuf);
+ regcache->raw_supply_zeroed (E_E9_REGNUM);
break;
case E_E10_REGNUM:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
- regcache_raw_supply (regcache, E_E10_REGNUM, zerobuf);
-
+ regcache->raw_supply_zeroed (E_E10_REGNUM);
break;
case E_MCRH_REGNUM:
regcache_raw_supply (regcache, E_MCRH_REGNUM,
@@ -218,12 +213,10 @@ am33_supply_gregset_method (const struct regset *regset,
break;
case E_FPCR_REGNUM + 1:
/* The two unused registers beyond fpcr are inaccessible. */
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
- regcache_raw_supply (regcache, E_FPCR_REGNUM + 1, zerobuf);
+ regcache->raw_supply_zeroed (E_FPCR_REGNUM + 1);
break;
case E_FPCR_REGNUM + 2:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
- regcache_raw_supply (regcache, E_FPCR_REGNUM + 2, zerobuf);
+ regcache->raw_supply_zeroed (E_FPCR_REGNUM + 2);
break;
default: /* An error, obviously, but should we error out? */
break;