/* Target-dependent code for Renesas Super-H, for GDB.
- Copyright (C) 1993-2017 Free Software Foundation, Inc.
+ Copyright (C) 1993-2018 Free Software Foundation, Inc.
This file is part of GDB.
#include "arch-utils.h"
#include "regcache.h"
#include "osabi.h"
+#include "target-float.h"
#include "valprint.h"
+#include "target-float.h"
#include "elf-bfd.h"
sh64_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
int len = TYPE_LENGTH (type);
if (TYPE_CODE (type) == TYPE_CODE_FLT)
gdb_byte buf[8];
regcache_cooked_read (regcache, DR0_REGNUM, buf);
- convert_typed_floating (buf, sh64_littlebyte_bigword_type (gdbarch),
- valbuf, type);
+ target_float_convert (buf, sh64_littlebyte_bigword_type (gdbarch),
+ valbuf, type);
}
}
else
sh64_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
gdb_byte buf[64]; /* more than enough... */
int len = TYPE_LENGTH (type);
&& regnum <= DR_LAST_REGNUM)
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
- convert_typed_floating (from, sh64_littlebyte_bigword_type (gdbarch),
- to, type);
+ target_float_convert (from, sh64_littlebyte_bigword_type (gdbarch),
+ to, type);
else
error (_("sh64_register_convert_to_virtual "
"called with non DR register number"));
static void
sh64_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
- int regnum, const void *from, void *to)
+ int regnum, const gdb_byte *from, gdb_byte *to)
{
if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_LITTLE)
{
&& regnum <= DR_LAST_REGNUM)
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
- convert_typed_floating (from, type,
- to, sh64_littlebyte_bigword_type (gdbarch));
+ target_float_convert (from, type,
+ to, sh64_littlebyte_bigword_type (gdbarch));
else
error (_("sh64_register_convert_to_raw called "
"with non DR register number"));
static enum register_status
pseudo_register_read_portions (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int portions,
int base_regnum, gdb_byte *buffer)
{
gdb_byte *b;
b = buffer + register_size (gdbarch, base_regnum) * portion;
- status = regcache_raw_read (regcache, base_regnum + portion, b);
+ status = regcache->raw_read (base_regnum + portion, b);
if (status != REG_VALID)
return status;
}
}
static enum register_status
-sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+sh64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
- status = regcache_raw_read (regcache, base_regnum, temp_buffer);
+ status = regcache->raw_read (base_regnum, temp_buffer);
if (status != REG_VALID)
return status;
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
/* Build the value in the provided buffer. */
/* Floating point registers map 1-1 to the media fp regs,
they have the same size and endianness. */
- return regcache_raw_read (regcache, base_regnum, buffer);
+ return regcache->raw_read (base_regnum, buffer);
}
else if (reg_nr >= DR0_C_REGNUM
/* FPUL_C register is floating point register 32,
same size, same endianness. */
- return regcache_raw_read (regcache, base_regnum, buffer);
+ return regcache->raw_read (base_regnum, buffer);
}
else
gdb_assert_not_reached ("invalid pseudo register number");
struct frame_info *frame, int regnum)
{ /* Do values for FP (float) regs. */
unsigned char *raw_buffer;
- double flt; /* Double extracted from raw hex data. */
- int inv;
/* Allocate space for the float. */
raw_buffer = (unsigned char *)
error (_("can't read register %d (%s)"),
regnum, gdbarch_register_name (gdbarch, regnum));
- /* Get the register as a number. */
- flt = unpack_double (builtin_type (gdbarch)->builtin_float,
- raw_buffer, &inv);
-
/* Print the name and some spaces. */
fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
print_spaces_filtered (15 - strlen (gdbarch_register_name
(gdbarch, regnum)), file);
/* Print the value. */
- if (inv)
- fprintf_filtered (file, "<invalid float>");
- else
- fprintf_filtered (file, "%-10.9g", flt);
+ const struct type *flt_type = builtin_type (gdbarch)->builtin_float;
+ std::string str = target_float_to_string (raw_buffer, flt_type, "%-10.9g");
+ fprintf_filtered (file, "%s", str.c_str ());
/* Print the fp register as hex. */
fprintf_filtered (file, "\t(raw ");