aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/arch-utils.c17
-rw-r--r--gdb/arch-utils.h3
-rw-r--r--gdb/gdbarch.c7
-rw-r--r--gdb/gdbarch.h5
-rwxr-xr-xgdb/gdbarch.sh2
-rw-r--r--gdb/regcache.c3
7 files changed, 40 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2546b43..53f5c66 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2002-08-09 Andrew Cagney <cagney@redhat.com>
+ * regcache.c (regcache_dump): Compare the register offset
+ with REGISTER_BYTE.
+ * arch-utils.c (generic_register_byte): New function.
+ * arch-utils.h (generic_register_byte): Declare.
+ * gdbarch.sh (REGISTER_BYTE): Default to generic_register_byte.
+ * gdbarch.h, gdbarch.c: Regenerate.
+
+2002-08-09 Andrew Cagney <cagney@redhat.com>
+
* regcache.c: Include "gdbcmd.h"
(_initialize_regcache): Add commands "maintenance print
registers", "maintenance print raw-registers" and "maintenance
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index a407f9e..5497e83 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -444,6 +444,23 @@ generic_register_size (int regnum)
(name && STREQ ("_sigtramp", name))
#endif
#endif
+
+/* Assume all registers are adjacent. */
+
+int
+generic_register_byte (int regnum)
+{
+ int byte;
+ int i;
+ gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
+ byte = 0;
+ for (i = 0; i < regnum; i++)
+ {
+ byte += TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i));
+ }
+ return byte;
+}
+
int
legacy_pc_in_sigtramp (CORE_ADDR pc, char *name)
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 7ceb8b7..a38272c 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -155,6 +155,9 @@ extern void default_print_float_info (struct gdbarch *gdbarch,
extern int generic_register_size (int regnum);
+/* Assume that the world is sane, the registers are all adjacent. */
+extern int generic_register_byte (int regnum);
+
/* Prop up old targets that use various IN_SIGTRAMP() macros. */
extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 93a5c0e..e2e5b7b 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -315,7 +315,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
- 0,
+ generic_register_byte,
generic_register_size,
0,
generic_register_size,
@@ -484,6 +484,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->register_name = legacy_register_name;
current_gdbarch->register_size = -1;
current_gdbarch->register_bytes = -1;
+ current_gdbarch->register_byte = generic_register_byte;
current_gdbarch->register_raw_size = generic_register_size;
current_gdbarch->max_register_raw_size = -1;
current_gdbarch->register_virtual_size = generic_register_size;
@@ -623,9 +624,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->register_bytes == -1))
fprintf_unfiltered (log, "\n\tregister_bytes");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->register_byte == 0))
- fprintf_unfiltered (log, "\n\tregister_byte");
+ /* Skip verify of register_byte, invalid_p == 0 */
/* Skip verify of register_raw_size, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->max_register_raw_size == -1))
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 57fb0cf..973f250 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -693,6 +693,11 @@ extern void set_gdbarch_register_bytes (struct gdbarch *gdbarch, int register_by
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTE)
+#define REGISTER_BYTE(reg_nr) (generic_register_byte (reg_nr))
+#endif
+
typedef int (gdbarch_register_byte_ftype) (int reg_nr);
extern int gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr);
extern void set_gdbarch_register_byte (struct gdbarch *gdbarch, gdbarch_register_byte_ftype *register_byte);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 141eba3..f416aea 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -461,7 +461,7 @@ f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:
f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0
v:2:REGISTER_SIZE:int:register_size::::0:-1
v:2:REGISTER_BYTES:int:register_bytes::::0:-1
-f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
+f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte::0
f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
diff --git a/gdb/regcache.c b/gdb/regcache.c
index dcfe7aa..c633d2d 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1279,7 +1279,8 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
{
fprintf_unfiltered (file, " %6ld",
regcache->descr->register_offset[regnum]);
- if (register_offset != regcache->descr->register_offset[regnum])
+ if (register_offset != regcache->descr->register_offset[regnum]
+ || register_offset != REGISTER_BYTE (regnum))
{
if (!footnote_register_offset)
footnote_register_offset = ++footnote_nr;