From d7a0d72c953815f254dbaa7745deb63d28e93aec Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Wed, 9 May 2001 09:58:45 +0000 Subject: [PATCH] * i386-tdep.c (i386_register_virtual_type): New function. (i386_register_convertible): New function. * config/i386/tm-i386.h (REGISTER_VIRTUAL_TYPE): Redefine in terms of i386_register_virtual_type. (REGISTER_CONVERTIBLE): Redefine in terms of i386_register_convertible. (i386_register_virtual_type, i386_register_convertible): New prototypes. --- gdb/ChangeLog | 11 +++++++++++ gdb/config/i386/tm-i386.h | 24 +++++++++--------------- gdb/i386-tdep.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 15d4ba97e0..2f82bb7118 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2001-05-09 Mark Kettenis + + * i386-tdep.c (i386_register_virtual_type): New function. + (i386_register_convertible): New function. + * config/i386/tm-i386.h (REGISTER_VIRTUAL_TYPE): Redefine in terms + of i386_register_virtual_type. + (REGISTER_CONVERTIBLE): Redefine in terms of + i386_register_convertible. + (i386_register_virtual_type, i386_register_convertible): New + prototypes. + 2001-05-08 Jim Blandy * Makefile.in (mn10300-tdep.o): New rule. diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h index 8939d86ca1..a59ed82d04 100644 --- a/gdb/config/i386/tm-i386.h +++ b/gdb/config/i386/tm-i386.h @@ -238,23 +238,17 @@ extern int i386_register_virtual_size[]; /* Largest value REGISTER_VIRTUAL_SIZE can have. */ #define MAX_REGISTER_VIRTUAL_SIZE 16 -/* Return the GDB type object for the "standard" data type of data in - register N. Perhaps si and di should go here, but potentially they - could be used for things other than address. */ +/* Return the GDB type object for the "standard" data type of data in + register REGNUM. */ -#define REGISTER_VIRTUAL_TYPE(N) \ - (((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM) \ - ? lookup_pointer_type (builtin_type_void) \ - : IS_FP_REGNUM(N) ? builtin_type_long_double \ - : IS_SSE_REGNUM(N) ? builtin_type_v4sf \ - : builtin_type_int) +#define REGISTER_VIRTUAL_TYPE(regnum) i386_register_virtual_type (regnum) +extern struct type *i386_register_virtual_type (int regnum); -/* REGISTER_CONVERTIBLE(N) is true iff register N's virtual format is - different from its raw format. Note that this definition assumes - that the host supports IEEE 32-bit floats, since it doesn't say - that SSE registers need conversion. Even if we can't find a - counterexample, this is still sloppy. */ -#define REGISTER_CONVERTIBLE(n) (IS_FP_REGNUM (n)) +/* Return true iff register REGNUM's virtual format is different from + its raw format. */ + +#define REGISTER_CONVERTIBLE(regnum) i386_register_convertible (regnum) +extern int i386_register_convertible (int regnum); /* Convert data from raw format for register REGNUM in buffer FROM to virtual format with type TYPE in buffer TO. */ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 7477266f43..446b268481 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -905,6 +905,37 @@ i386_extract_struct_value_address (char *regbuf) } +/* Return the GDB type object for the "standard" data type of data in + register REGNUM. Perhaps %esi and %edi should go here, but + potentially they could be used for things other than address. */ + +struct type * +i386_register_virtual_type (int regnum) +{ + if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) + return lookup_pointer_type (builtin_type_void); + + if (IS_FP_REGNUM (regnum)) + return builtin_type_long_double; + + if (IS_SSE_REGNUM (regnum)) + return builtin_type_v4sf; + + return builtin_type_int; +} + +/* Return true iff register REGNUM's virtual format is different from + its raw format. Note that this definition assumes that the host + supports IEEE 32-bit floats, since it doesn't say that SSE + registers need conversion. Even if we can't find a counterexample, + this is still sloppy. */ + +int +i386_register_convertible (int regnum) +{ + return IS_FP_REGNUM (regnum); +} + /* Convert data from raw format for register REGNUM in buffer FROM to virtual format with type TYPE in buffer TO. In principle both formats are identical except that the virtual format has two extra