* amd64-tdep.c (amd64_convert_register_p): Delete.

(amd64_init_abi): Use i387_convert_register_p.
	* alpha-tdep.c (alpha_convert_register_p): Return zero for
	eight byte types.
	(alpha_register_to_value, alpha_value_to_register): Do not handle
	eight byte types.
	* i386-tdep.c (i386_convert_register_p): Use i387_convert_register_p.
	* i387-tdep.c (i387_convert_register_p): New.
	(i387_register_to_value, i387_value_to_register): Update comments.
	* i387-tdep.h (i387_convert_register_p): Declare.
	* ia64-tdep.c (ia64_convert_register_p): Return zero for
	builtin_type_ia64_ext.
	(ia64_gdbarch_init): Do not initialize builtin_type_ia64_ext here.
	(_initialize_ia64_tdep): Initialize builtin_type_ia64_ext here.
	* m68k-tdep.c (m68k_convert_register_p): Return zero for
	builtin_type_m68881_ext.
	(m68k_register_to_value, m68k_value_to_register): Update comments.

	* gdbint.texinfo (Register and Memory Data, Target Conditionals):
	Document that gdbarch_convert_register_p should return zero for no-op
	conversions.
This commit is contained in:
Daniel Jacobowitz 2007-10-24 20:29:14 +00:00
parent 24bf05ac93
commit 83acabca13
10 changed files with 75 additions and 37 deletions

View File

@ -1,3 +1,23 @@
2007-10-24 Daniel Jacobowitz <dan@codesourcery.com>
* amd64-tdep.c (amd64_convert_register_p): Delete.
(amd64_init_abi): Use i387_convert_register_p.
* alpha-tdep.c (alpha_convert_register_p): Return zero for
eight byte types.
(alpha_register_to_value, alpha_value_to_register): Do not handle
eight byte types.
* i386-tdep.c (i386_convert_register_p): Use i387_convert_register_p.
* i387-tdep.c (i387_convert_register_p): New.
(i387_register_to_value, i387_value_to_register): Update comments.
* i387-tdep.h (i387_convert_register_p): Declare.
* ia64-tdep.c (ia64_convert_register_p): Return zero for
builtin_type_ia64_ext.
(ia64_gdbarch_init): Do not initialize builtin_type_ia64_ext here.
(_initialize_ia64_tdep): Initialize builtin_type_ia64_ext here.
* m68k-tdep.c (m68k_convert_register_p): Return zero for
builtin_type_m68881_ext.
(m68k_register_to_value, m68k_value_to_register): Update comments.
2007-10-24 Nathan Sidwell <nathan@codesourcery.com>
* target-memory.c (claim_memory): Propagate baton for split memory

View File

@ -200,7 +200,8 @@ alpha_sts (void *out, const void *in)
static int
alpha_convert_register_p (int regno, struct type *type)
{
return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31);
return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31
&& TYPE_LENGTH (type) != 8);
}
static void
@ -215,9 +216,6 @@ alpha_register_to_value (struct frame_info *frame, int regnum,
case 4:
alpha_sts (out, in);
break;
case 8:
memcpy (out, in, 8);
break;
default:
error (_("Cannot retrieve value from floating point register"));
}
@ -234,9 +232,6 @@ alpha_value_to_register (struct frame_info *frame, int regnum,
case 4:
alpha_lds (out, in);
break;
case 8:
memcpy (out, in, 8);
break;
default:
error (_("Cannot store value in floating point register"));
}

View File

@ -200,14 +200,6 @@ amd64_dwarf_reg_to_regnum (int reg)
return regnum;
}
/* Return nonzero if a value of type TYPE stored in register REGNUM
needs any special handling. */
static int
amd64_convert_register_p (int regnum, struct type *type)
{
return i386_fp_regnum_p (regnum);
}
/* Register classes as defined in the psABI. */
@ -1155,7 +1147,7 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_frame_align (gdbarch, amd64_frame_align);
set_gdbarch_frame_red_zone_size (gdbarch, 128);
set_gdbarch_convert_register_p (gdbarch, amd64_convert_register_p);
set_gdbarch_convert_register_p (gdbarch, i387_convert_register_p);
set_gdbarch_register_to_value (gdbarch, i387_register_to_value);
set_gdbarch_value_to_register (gdbarch, i387_value_to_register);

View File

@ -1,12 +1,18 @@
2007-10-24 Daniel Jacobowitz <dan@codesourcery.com>
* gdbint.texinfo (Register and Memory Data, Target Conditionals):
Document that gdbarch_convert_register_p should return zero for no-op
conversions.
2007-10-22 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.texi (Compiler Characteristics): Move documentation
* gdbint.texi (Compiler Characteristics): Move documentation
of set_gdbarch_sofun_address_maybe_missing back to ...
(Target Conditionals): ... here to fix build break.
2007-10-19 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.texi (Target Conditionals): Remove documentation of
* gdbint.texi (Target Conditionals): Remove documentation of
SOFUN_ADDRESS_MAYBE_MISSING, replaced by ...
(Compiler Characteristics): ... documentation of
set_gdbarch_sofun_address_maybe_missing.

View File

@ -3226,6 +3226,9 @@ when stored in memory.
When non-zero, the macros @code{gdbarch_register_to_value} and
@code{value_to_register} are used to perform any necessary conversion.
This function should return zero for the register's native type, when
no conversion is necessary.
@end deftypefun
@deftypefun void gdbarch_register_to_value (struct gdbarch *@var{gdbarch}, int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to})
@ -3462,8 +3465,8 @@ default so that @value{GDBN} will assume that all registers may be written.
@item int gdbarch_convert_register_p (@var{gdbarch}, @var{regnum}, struct type *@var{type})
@findex gdbarch_convert_register_p
Return non-zero if register @var{regnum} can represent data values in a
non-standard form.
Return non-zero if register @var{regnum} represents data values of type
@var{type} in a non-standard form.
@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
@item CORE_ADDR gdbarch_decr_pc_after_break (@var{gdbarch})

View File

@ -1880,7 +1880,7 @@ i386_convert_register_p (int regnum, struct type *type)
return 1;
}
return i386_fp_regnum_p (regnum);
return i387_convert_register_p (regnum, type);
}
/* Read a value of type TYPE from register REGNUM in frame FRAME, and

View File

@ -285,6 +285,25 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
}
/* Return nonzero if a value of type TYPE stored in register REGNUM
needs any special handling. */
int
i387_convert_register_p (int regnum, struct type *type)
{
if (i386_fp_regnum_p (regnum))
{
/* Floating point registers must be converted unless we are
accessing them in their hardware type. */
if (type == builtin_type_i387_ext)
return 0;
else
return 1;
}
return 0;
}
/* Read a value of type TYPE from register REGNUM in frame FRAME, and
return its contents in TO. */
@ -304,8 +323,7 @@ i387_register_to_value (struct frame_info *frame, int regnum,
return;
}
/* Convert to TYPE. This should be a no-op if TYPE is equivalent to
the extended floating-point format used by the FPU. */
/* Convert to TYPE. */
get_frame_register (frame, regnum, from);
convert_typed_floating (from, builtin_type_i387_ext, to, type);
}
@ -329,8 +347,7 @@ i387_value_to_register (struct frame_info *frame, int regnum,
return;
}
/* Convert from TYPE. This should be a no-op if TYPE is equivalent
to the extended floating-point format used by the FPU. */
/* Convert from TYPE. */
convert_typed_floating (from, type, to, builtin_type_i387_ext);
put_frame_register (frame, regnum, to);
}

View File

@ -55,6 +55,11 @@ extern void i387_print_float_info (struct gdbarch *gdbarch,
struct frame_info *frame,
const char *args);
/* Return nonzero if a value of type TYPE stored in register REGNUM
needs any special handling. */
extern int i387_convert_register_p (int regnum, struct type *type);
/* Read a value of type TYPE from register REGNUM in frame FRAME, and
return its contents in TO. */

View File

@ -920,7 +920,8 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
static int
ia64_convert_register_p (int regno, struct type *type)
{
return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM);
return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM
&& type != builtin_type_ia64_ext);
}
static void
@ -3564,12 +3565,6 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->sigcontext_register_address = 0;
tdep->pc_in_sigtramp = 0;
/* Define the ia64 floating-point format to gdb. */
builtin_type_ia64_ext =
init_type (TYPE_CODE_FLT, 128 / 8,
0, "builtin_type_ia64_ext", NULL);
TYPE_FLOATFORMAT (builtin_type_ia64_ext) = floatformats_ia64_ext;
/* According to the ia64 specs, instructions that store long double
floats in memory use a long-double format different than that
used in the floating registers. The memory format matches the
@ -3652,5 +3647,11 @@ extern initialize_file_ftype _initialize_ia64_tdep; /* -Wmissing-prototypes */
void
_initialize_ia64_tdep (void)
{
/* Define the ia64 floating-point format to gdb. */
builtin_type_ia64_ext =
init_type (TYPE_CODE_FLT, 128 / 8,
0, "builtin_type_ia64_ext", NULL);
TYPE_FLOATFORMAT (builtin_type_ia64_ext) = floatformats_ia64_ext;
gdbarch_register (bfd_arch_ia64, ia64_gdbarch_init, NULL);
}

View File

@ -171,7 +171,8 @@ m68k_convert_register_p (int regnum, struct type *type)
{
if (!gdbarch_tdep (current_gdbarch)->fpregs_present)
return 0;
return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7);
return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7
&& type != builtin_type_m68881_ext);
}
/* Read a value of type TYPE from register REGNUM in frame FRAME, and
@ -193,8 +194,7 @@ m68k_register_to_value (struct frame_info *frame, int regnum,
return;
}
/* Convert to TYPE. This should be a no-op if TYPE is equivalent to
the extended floating-point format used by the FPU. */
/* Convert to TYPE. */
get_frame_register (frame, regnum, from);
convert_typed_floating (from, fpreg_type, to, type);
}
@ -218,8 +218,7 @@ m68k_value_to_register (struct frame_info *frame, int regnum,
return;
}
/* Convert from TYPE. This should be a no-op if TYPE is equivalent
to the extended floating-point format used by the FPU. */
/* Convert from TYPE. */
convert_typed_floating (from, type, to, fpreg_type);
put_frame_register (frame, regnum, to);
}