From: Mark Kettenis Date: Sun, 4 Nov 2001 13:51:48 +0000 (+0000) Subject: * i386-tdep.c (i386_register_offset): Renamed from X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a11ba71e20375b800164239d54fad75d73fa22c;p=binutils-gdb.git * i386-tdep.c (i386_register_offset): Renamed from i386_register_byte. Made static. (i386_register_size): Renamed from i386_register_raw_size. Made static. (i386_register_virtual_size): Removed. (i386_register_byte, i386_register_raw_size, i386_register_virtual_size): New functions. (_initialize_i386_tdep): Initialize i386_register_offset instead of i386_register_byte. Remove code to initialize i386_register_virtual_size. * config/i386/tm-i386.h (REGISTER_BYTE): Redefine to use i386_register_byte function. (REGISTER_RAW_SIZE): Redefine to use i386_register_raw_size function. (REGISTER_VIRTUAL_SIZE): Redefine to use i386_register_virtual_size function. (i386_register_byte, i386_register_raw_size, i386_register_virtual_size): New functions. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f8e3b14f5d5..bf2af41990a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,24 @@ 2001-11-04 Mark Kettenis + * i386-tdep.c (i386_register_offset): Renamed from + i386_register_byte. Made static. + (i386_register_size): Renamed from i386_register_raw_size. Made + static. + (i386_register_virtual_size): Removed. + (i386_register_byte, i386_register_raw_size, + i386_register_virtual_size): New functions. + (_initialize_i386_tdep): Initialize i386_register_offset instead + of i386_register_byte. Remove code to initialize + i386_register_virtual_size. + * config/i386/tm-i386.h (REGISTER_BYTE): Redefine to use + i386_register_byte function. + (REGISTER_RAW_SIZE): Redefine to use i386_register_raw_size + function. + (REGISTER_VIRTUAL_SIZE): Redefine to use + i386_register_virtual_size function. + (i386_register_byte, i386_register_raw_size, + i386_register_virtual_size): New functions. + * Makefile.in (ALLDEPFILES): Add i387-nat.c. (i387-nat.o): Add dependencies. diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h index e821700fdee..aba5c15bb43 100644 --- a/gdb/config/i386/tm-i386.h +++ b/gdb/config/i386/tm-i386.h @@ -220,22 +220,22 @@ extern int i386_dwarf_reg_to_regnum (int reg); #endif #endif -/* Index within `registers' of the first byte of the space for register N. */ -#define REGISTER_BYTE(n) (i386_register_byte[(n)]) -extern int i386_register_byte[]; +/* Return the offset into the register array of the start of register + number REG. */ +#define REGISTER_BYTE(reg) i386_register_byte ((reg)) +extern int i386_register_byte (int reg); -/* Number of bytes of storage in the actual machine representation for - register N. */ -#define REGISTER_RAW_SIZE(n) (i386_register_raw_size[(n)]) -extern int i386_register_raw_size[]; +/* Return the number of bytes of storage in GDB's register array + occupied by register REG. */ +#define REGISTER_RAW_SIZE(reg) i386_register_raw_size ((reg)) +extern int i386_register_raw_size (int reg); /* Largest value REGISTER_RAW_SIZE can have. */ #define MAX_REGISTER_RAW_SIZE 16 -/* Number of bytes of storage in the program's representation - for register N. */ -#define REGISTER_VIRTUAL_SIZE(n) (i386_register_virtual_size[(n)]) -extern int i386_register_virtual_size[]; +/* Return the size in bytes of the virtual type of register REG. */ +#define REGISTER_VIRTUAL_SIZE(reg) i386_register_virtual_size ((reg)) +extern int i386_register_virtual_size (int reg); /* Largest value REGISTER_VIRTUAL_SIZE can have. */ #define MAX_REGISTER_VIRTUAL_SIZE 16 diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 4035e93187d..15ff15fca11 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -54,14 +54,14 @@ static char *i386_register_names[] = "mxcsr" }; -/* i386_register_byte[i] is the offset into the register file of the +/* i386_register_offset[i] is the offset into the register file of the start of register number i. We initialize this from - i386_register_raw_size. */ -int i386_register_byte[MAX_NUM_REGS]; + i386_register_size. */ +static int i386_register_offset[MAX_NUM_REGS]; -/* i386_register_raw_size[i] is the number of bytes of storage in - GDB's register array occupied by register i. */ -int i386_register_raw_size[MAX_NUM_REGS] = { +/* i386_register_size[i] is the number of bytes of storage in GDB's + register array occupied by register i. */ +static int i386_register_size[MAX_NUM_REGS] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, @@ -75,10 +75,6 @@ int i386_register_raw_size[MAX_NUM_REGS] = { 4 }; -/* i386_register_virtual_size[i] is the size in bytes of the virtual - type of register i. */ -int i386_register_virtual_size[MAX_NUM_REGS]; - /* Return the name of register REG. */ char * @@ -92,6 +88,31 @@ i386_register_name (int reg) return i386_register_names[reg]; } +/* Return the offset into the register array of the start of register + number REG. */ +int +i386_register_byte (int reg) +{ + return i386_register_offset[reg]; +} + +/* Return the number of bytes of storage in GDB's register array + occupied by register REG. */ + +int +i386_register_raw_size (int reg) +{ + return i386_register_size[reg]; +} + +/* Return the size in bytes of the virtual type of register REG. */ + +int +i386_register_virtual_size (int reg) +{ + return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (reg)); +} + /* Convert stabs register number REG to the appropriate register number used by GDB. */ @@ -1215,19 +1236,11 @@ _initialize_i386_tdep (void) offset = 0; for (i = 0; i < MAX_NUM_REGS; i++) { - i386_register_byte[i] = offset; - offset += i386_register_raw_size[i]; + i386_register_offset[i] = offset; + offset += i386_register_size[i]; } } - /* Initialize the table of virtual register sizes. */ - { - int i; - - for (i = 0; i < MAX_NUM_REGS; i++) - i386_register_virtual_size[i] = TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i)); - } - tm_print_insn = gdb_print_insn_i386; tm_print_insn_info.mach = bfd_lookup_arch (bfd_arch_i386, 0)->mach;