diff options
author | Mark Kettenis <kettenis@gnu.org> | 2002-07-04 08:18:20 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2002-07-04 08:18:20 +0000 |
commit | 00f8375eddd0063911d7181574bf1fec7fec491b (patch) | |
tree | 5e1e445f932b19dd3a671cfcbc7bc1467000507e /gdb | |
parent | c0d1d883540ac568c7029ec9df759541aa875f38 (diff) | |
download | gdb-00f8375eddd0063911d7181574bf1fec7fec491b.zip gdb-00f8375eddd0063911d7181574bf1fec7fec491b.tar.gz gdb-00f8375eddd0063911d7181574bf1fec7fec491b.tar.bz2 |
* i386-tdep.h (I386_MAX_REGISTER_SIZE): New define.
* i386-tdep.c (i386_do_pop_frame): Use I386_MAX_REGISTER_SIZE
instead of MAX_REGISTER_RAW_SIZE.
(i386_extract_return_value, i386_extract_struct_value_address):
Convert to use regcache.
(i386_gdbarch_init): Set max_register_raw_size and
max_register_virtual_size to I386_MAX_REGISTER_SIZE.
Set extract_return_value and extract_struct_value_address instead
of their deprecated variants.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 39 | ||||
-rw-r--r-- | gdb/i386-tdep.h | 3 |
3 files changed, 34 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de56791..513ae24 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2002-07-04 Mark Kettenis <kettenis@gnu.org> + * i386-tdep.h (I386_MAX_REGISTER_SIZE): New define. + * i386-tdep.c (i386_do_pop_frame): Use I386_MAX_REGISTER_SIZE + instead of MAX_REGISTER_RAW_SIZE. + (i386_extract_return_value, i386_extract_struct_value_address): + Convert to use regcache. + (i386_gdbarch_init): Set max_register_raw_size and + max_register_virtual_size to I386_MAX_REGISTER_SIZE. + Set extract_return_value and extract_struct_value_address instead + of their deprecated variants. + Convert i386 target to generic dummy frames. * i386-tdep.c: Include "symfile.h". (i386_frameless_signal_p): Consider a function to be frameless if diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index e638f75..342a713 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -841,7 +841,7 @@ i386_do_pop_frame (struct frame_info *frame) { CORE_ADDR fp; int regnum; - char regbuf[MAX_REGISTER_RAW_SIZE]; + char regbuf[I386_MAX_REGISTER_SIZE]; fp = FRAME_FP (frame); i386_frame_init_saved_regs (frame); @@ -936,14 +936,16 @@ i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) into VALBUF. */ static void -i386_extract_return_value (struct type *type, char *regbuf, char *valbuf) +i386_extract_return_value (struct type *type, struct regcache *regcache, + char *valbuf) { int len = TYPE_LENGTH (type); + char buf[I386_MAX_REGISTER_SIZE]; if (TYPE_CODE (type) == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) { - i386_extract_return_value (TYPE_FIELD_TYPE (type, 0), regbuf, valbuf); + i386_extract_return_value (TYPE_FIELD_TYPE (type, 0), regcache, valbuf); return; } @@ -960,8 +962,8 @@ i386_extract_return_value (struct type *type, char *regbuf, char *valbuf) its contents to the desired type. This is probably not exactly how it would happen on the target itself, but it is the best we can do. */ - convert_typed_floating (®buf[REGISTER_BYTE (FP0_REGNUM)], - builtin_type_i387_ext, valbuf, type); + regcache_read (regcache, FP0_REGNUM, buf); + convert_typed_floating (buf, builtin_type_i387_ext, valbuf, type); } else { @@ -969,13 +971,16 @@ i386_extract_return_value (struct type *type, char *regbuf, char *valbuf) int high_size = REGISTER_RAW_SIZE (HIGH_RETURN_REGNUM); if (len <= low_size) - memcpy (valbuf, ®buf[REGISTER_BYTE (LOW_RETURN_REGNUM)], len); + { + regcache_read (regcache, LOW_RETURN_REGNUM, buf); + memcpy (valbuf, buf, len); + } else if (len <= (low_size + high_size)) { - memcpy (valbuf, - ®buf[REGISTER_BYTE (LOW_RETURN_REGNUM)], low_size); - memcpy (valbuf + low_size, - ®buf[REGISTER_BYTE (HIGH_RETURN_REGNUM)], len - low_size); + regcache_read (regcache, LOW_RETURN_REGNUM, buf); + memcpy (valbuf, buf, low_size); + regcache_read (regcache, HIGH_RETURN_REGNUM, buf); + memcpy (valbuf + low_size, buf, len - low_size); } else internal_error (__FILE__, __LINE__, @@ -1059,10 +1064,9 @@ i386_store_return_value (struct type *type, char *valbuf) as a CORE_ADDR. */ static CORE_ADDR -i386_extract_struct_value_address (char *regbuf) +i386_extract_struct_value_address (struct regcache *regcache) { - return extract_address (®buf[REGISTER_BYTE (LOW_RETURN_REGNUM)], - REGISTER_RAW_SIZE (LOW_RETURN_REGNUM)); + return regcache_read_as_address (regcache, LOW_RETURN_REGNUM); } @@ -1437,8 +1441,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_bytes (gdbarch, I386_SIZEOF_GREGS + I386_SIZEOF_FREGS); set_gdbarch_register_byte (gdbarch, i386_register_byte); set_gdbarch_register_raw_size (gdbarch, i386_register_raw_size); - set_gdbarch_max_register_raw_size (gdbarch, 16); - set_gdbarch_max_register_virtual_size (gdbarch, 16); + set_gdbarch_max_register_raw_size (gdbarch, I386_MAX_REGISTER_SIZE); + set_gdbarch_max_register_virtual_size (gdbarch, I386_MAX_REGISTER_SIZE); set_gdbarch_register_virtual_type (gdbarch, i386_register_virtual_type); set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target); @@ -1473,15 +1477,14 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) depending on the size of the argument" -- from the x86 ABI. */ set_gdbarch_parm_boundary (gdbarch, 32); - set_gdbarch_deprecated_extract_return_value (gdbarch, - i386_extract_return_value); + set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value); set_gdbarch_push_arguments (gdbarch, i386_push_arguments); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); set_gdbarch_push_return_address (gdbarch, i386_push_return_address); set_gdbarch_pop_frame (gdbarch, i386_pop_frame); set_gdbarch_store_struct_return (gdbarch, i386_store_struct_return); set_gdbarch_store_return_value (gdbarch, i386_store_return_value); - set_gdbarch_deprecated_extract_struct_value_address (gdbarch, + set_gdbarch_extract_struct_value_address (gdbarch, i386_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, i386_use_struct_convention); diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index d255c40..bd5213f 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -157,6 +157,9 @@ struct gdbarch_tdep #define I386_SSE_SIZEOF_REGS (I386_SIZEOF_GREGS + I386_SIZEOF_FREGS \ + I386_SIZEOF_XREGS) +/* Size of the largest register. */ +#define I386_MAX_REGISTER_SIZE 16 + /* Return the name of register REG. */ extern char const *i386_register_name (int reg); |