This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 11/11] Add SH_MAX_REGISTER_SIZE and SH64_MAX_REGISTER_SIZE
- From: Alan Hayward <Alan dot Hayward at arm dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Tue, 4 Apr 2017 10:16:31 +0000
- Subject: [PATCH 11/11] Add SH_MAX_REGISTER_SIZE and SH64_MAX_REGISTER_SIZE
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com;
- Nodisclaimer: True
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Max size set to 96bits, which I determined using the various sh*register_type() functions.
Tested on a --enable-targets=all build using make check with board files
unix and native-gdbserver.
I do not have a SH machine to test on.
Ok to commit?
Alan.
2017-04-04 Alan Hayward <alan.hayward@arm.com>
* sh-tdep.c (sh_pseudo_register_read): Use SH_MAX_REGISTER_SIZE.
(sh_pseudo_register_write): Likewise.
* sh64-tdep.c (SH_MAX_REGISTER_SIZE): Add.
(sh64_pseudo_register_read): Use SH64_MAX_REGISTER_SIZE..
(sh64_pseudo_register_write): Likewise.
* sh-tdep.h (SH64_MAX_REGISTER_SIZE): Add.
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index d15ef050e079aec93a8f2578bf6e94ace919061b..ca9bb25c947a7425e6160797ac05019b20fd4bff 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -82,6 +82,9 @@ enum
FV_LAST_REGNUM = 79
};
+/* Big enough to hold the size of the largest register in bytes. */
+#define SH_MAX_REGISTER_SIZE 12
+
/* This structure describes a register in a core-file. */
struct sh_corefile_regmap
{
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 9b3692dc0c32ffcb53d99f0fc095303d2c221fcb..7e56864202fe9321edb7561c721ef912b3a4f8c5 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1648,7 +1648,7 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
int base_regnum;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
+ gdb_byte temp_buffer[SH_MAX_REGISTER_SIZE];
enum register_status status;
if (reg_nr == PSEUDO_BANK_REGNUM)
@@ -1687,7 +1687,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
int base_regnum, portion;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
+ gdb_byte temp_buffer[SH_MAX_REGISTER_SIZE];
if (reg_nr == PSEUDO_BANK_REGNUM)
{
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 23f5ade3b2e631eeb50cb918a4f36bb8cfbe6131..19fce4fef6aba859491304c171fe16cb41ca3d37 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -122,6 +122,9 @@ enum
FP_LAST_REGNUM = SIM_SH64_FR0_REGNUM + SIM_SH64_NR_FP_REGS - 1
};
+/* Big enough to hold the size of the largest register in bytes. */
+#define SH64_MAX_REGISTER_SIZE 12
+
static const char *
sh64_register_name (struct gdbarch *gdbarch, int reg_nr)
{
@@ -1528,7 +1531,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int base_regnum;
int offset = 0;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
+ gdb_byte temp_buffer[SH64_MAX_REGISTER_SIZE];
enum register_status status;
if (reg_nr >= DR0_REGNUM
@@ -1704,7 +1707,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int base_regnum, portion;
int offset;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
+ gdb_byte temp_buffer[SH64_MAX_REGISTER_SIZE];
if (reg_nr >= DR0_REGNUM
&& reg_nr <= DR_LAST_REGNUM)