+2002-05-11 Andrew Cagney <ac131313@redhat.com>
+
+ * arch-utils.h (generic_register_size): Declare.
+ (generic_register_raw_size, generic_register_virtual_size): Delete
+ declarations.
+ * arch-utils.c (generic_register_raw_size): Delete.
+ (generic_register_size): New function.
+ (generic_register_virtual_size): Delete.
+
+ * gdbarch.sh (REGISTER_RAW_SIZE, REGISTER_VIRTUAL_SIZE): Make
+ default generic_register_size.
+ * gdbarch.h, gdbarch.c: Re-generate.
+
+ * d10v-tdep.c (d10v_gdbarch_init): Use generic_register_size for
+ register_virtual_size.
+ * x86-64-tdep.c (x86_64_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+
2002-05-11 Andrew Cagney <ac131313@redhat.com>
* gdbarch.sh (gdbarch_data): Add gdbarch parameter.
*frame_offset = 0;
}
-/* Assume the world is flat. Every register is large enough to fit a
- target integer. */
+/* Assume the world is sane, every register's virtual and real size
+ is identical. */
int
-generic_register_raw_size (int regnum)
+generic_register_size (int regnum)
{
gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
- return TARGET_INT_BIT / HOST_CHAR_BIT;
-}
-
-/* Assume the virtual size corresponds to the virtual type. */
-
-int
-generic_register_virtual_size (int regnum)
-{
return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
}
extern void default_print_float_info (void);
-/* Assume all registers are the same size and a size identical to that
- of the integer type. */
-extern int generic_register_raw_size (int regnum);
+/* Assume that the world is sane, a registers raw and virtual size
+ both match its type. */
-/* Assume the virtual size of registers corresponds to the virtual type. */
-
-extern int generic_register_virtual_size (int regnum);
+extern int generic_register_size (int regnum);
/* Prop up old targets that use various IN_SIGTRAMP() macros. */
extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name);
set_gdbarch_register_byte (gdbarch, d10v_register_byte);
set_gdbarch_register_raw_size (gdbarch, d10v_register_raw_size);
set_gdbarch_max_register_raw_size (gdbarch, 8);
- set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
+ set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
set_gdbarch_max_register_virtual_size (gdbarch, 8);
set_gdbarch_register_virtual_type (gdbarch, d10v_register_virtual_type);
+2002-05-11 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Mention
+ defaults for REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE.
+ (Target Architecture Definition): Mention same. Add references to
+ web pages.
+
2002-05-08 Michael Snyder <msnyder@redhat.com>
* stabs.texinfo (Attributes): Document new "vector" attribute.
@emph{Maintainer's note: The way GDB manipulates registers is undergoing
significant change. Many of the macros and functions refered to in the
-sections below are likely to be made obsolete. See the file @file{TODO}
-for more up-to-date information.}
+section below are likely to be made obsolete. For instance, instead of
+having different raw and virtual register sizes, an architecture can
+define pseudo-registers that map onto the raw registers.
+
+See the @uref{http://www.gnu.org/software/gdb/bugs/, Bug Tracking
+Database} and @uref{http://sources.redhat.com/gdb/current/ari, ARI
+Index} for more up-to-date information.}
Some architectures use one representation for a value when it lives in a
register, but use a different representation when it lives in memory.
@item REGISTER_RAW_SIZE (@var{reg})
@findex REGISTER_RAW_SIZE
-Return the raw size of @var{reg}.
+Return the raw size of @var{reg}; defaults to the size of the register's
+virtual type.
@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
@item REGISTER_VIRTUAL_SIZE (@var{reg})
@findex REGISTER_VIRTUAL_SIZE
-Return the virtual size of @var{reg}.
+Return the virtual size of @var{reg}; defaults to the size of the
+register's virtual type.
@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
@item REGISTER_VIRTUAL_TYPE (@var{reg})
0,
0,
0,
- generic_register_raw_size,
+ generic_register_size,
0,
- generic_register_virtual_size,
+ generic_register_size,
0,
0,
0,
current_gdbarch->register_name = legacy_register_name;
current_gdbarch->register_size = -1;
current_gdbarch->register_bytes = -1;
+ current_gdbarch->register_raw_size = generic_register_size;
current_gdbarch->max_register_raw_size = -1;
+ current_gdbarch->register_virtual_size = generic_register_size;
current_gdbarch->max_register_virtual_size = -1;
current_gdbarch->do_registers_info = do_registers_info;
current_gdbarch->print_float_info = default_print_float_info;
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->register_byte == 0))
fprintf_unfiltered (log, "\n\tregister_byte");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->register_raw_size == 0))
- fprintf_unfiltered (log, "\n\tregister_raw_size");
+ /* Skip verify of register_raw_size, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->max_register_raw_size == -1))
fprintf_unfiltered (log, "\n\tmax_register_raw_size");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->register_virtual_size == 0))
- fprintf_unfiltered (log, "\n\tregister_virtual_size");
+ /* Skip verify of register_virtual_size, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->max_register_virtual_size == -1))
fprintf_unfiltered (log, "\n\tmax_register_virtual_size");
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE)
+#define REGISTER_RAW_SIZE(reg_nr) (generic_register_size (reg_nr))
+#endif
+
typedef int (gdbarch_register_raw_size_ftype) (int reg_nr);
extern int gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr);
extern void set_gdbarch_register_raw_size (struct gdbarch *gdbarch, gdbarch_register_raw_size_ftype *register_raw_size);
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE)
+#define REGISTER_VIRTUAL_SIZE(reg_nr) (generic_register_size (reg_nr))
+#endif
+
typedef int (gdbarch_register_virtual_size_ftype) (int reg_nr);
extern int gdbarch_register_virtual_size (struct gdbarch *gdbarch, int reg_nr);
extern void set_gdbarch_register_virtual_size (struct gdbarch *gdbarch, gdbarch_register_virtual_size_ftype *register_virtual_size);
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_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size: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_virtual_size:0
+f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
set_gdbarch_register_byte (gdbarch, rs6000_register_byte);
set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size);
set_gdbarch_max_register_raw_size (gdbarch, 16);
- set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
+ set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
set_gdbarch_max_register_virtual_size (gdbarch, 16);
set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type);
set_gdbarch_do_registers_info (gdbarch, rs6000_do_registers_info);
for (i = 0, sum = 0; i < X86_64_NUM_REGS; i++)
sum += x86_64_register_info_table[i].size;
set_gdbarch_register_bytes (gdbarch, sum);
- set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
+ set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
set_gdbarch_max_register_virtual_size (gdbarch, 16);
set_gdbarch_register_virtual_type (gdbarch, x86_64_register_virtual_type);