/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
- Copyright (C) 1988-2022 Free Software Foundation, Inc.
+ Copyright (C) 1988-2023 Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
CORE_ADDR addr, int mustbe32);
static void mips_print_float_info (struct gdbarch *, struct ui_file *,
- frame_info_ptr , const char *);
+ frame_info_ptr, const char *);
/* A useful bit in the CP0 status register (MIPS_PS_REGNUM). */
/* This bit is set if we are emulating 32-bit FPRs on a 64-bit chip. */
case MIPS_ABI_UNKNOWN:
case MIPS_ABI_LAST:
default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
+ internal_error (_("bad switch"));
}
}
reg_offset = 0;
break;
default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
+ internal_error (_("bad switch"));
}
if (mips_debug)
gdb_printf (gdb_stderr,
return "";
}
else
- internal_error (__FILE__, __LINE__,
- _("mips_register_name: bad register number %d"), rawnum);
+ internal_error (_("mips_register_name: bad register number %d"), rawnum);
}
/* Return the groups that a MIPS register can be categorised into. */
}
}
else
- internal_error (__FILE__, __LINE__, _("bad register size"));
+ internal_error (_("bad register size"));
}
static void
}
}
else
- internal_error (__FILE__, __LINE__, _("bad register size"));
+ internal_error (_("bad register size"));
}
static int
}
}
else
- internal_error (__FILE__, __LINE__, _("bad register size"));
+ internal_error (_("bad register size"));
return 0;
}
}
else
{
- internal_error (__FILE__, __LINE__,
- _("mips_register_to_value: unrecognized case"));
+ internal_error (_("mips_register_to_value: unrecognized case"));
}
}
}
else
{
- internal_error (__FILE__, __LINE__,
- _("mips_value_to_register: unrecognized case"));
+ internal_error (_("mips_value_to_register: unrecognized case"));
}
}
case AUTO_BOOLEAN_AUTO:
return tdep->default_mask_address_p;
default:
- internal_error (__FILE__, __LINE__,
- _("mips_mask_address_p: bad switch"));
+ internal_error (_("mips_mask_address_p: bad switch"));
return -1;
}
}
instlen = MIPS_INSN32_SIZE;
break;
default:
- internal_error (__FILE__, __LINE__, _("invalid ISA"));
+ internal_error (_("invalid ISA"));
break;
}
err = target_read_memory (addr, buf, instlen);
case ISA_MIPS:
return MIPS_INSN32_SIZE;
}
- internal_error (__FILE__, __LINE__, _("invalid ISA"));
+ internal_error (_("invalid ISA"));
}
static LONGEST
break;
}
default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
+ internal_error (_("bad switch"));
}
upk->offset = offset;
upk->regx = regx;
than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
- arg_space += align_up (value_type (args[argnum])->length (),
+ arg_space += align_up (args[argnum]->type ()->length (),
abi_regsize);
sp -= align_up (arg_space, 16);
reference. */
gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE];
struct value *arg = args[argnum];
- struct type *arg_type = check_typedef (value_type (arg));
+ struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
{
gdb_assert (abi_regsize <= ARRAY_SIZE (ref_valbuf));
store_unsigned_integer (ref_valbuf, abi_regsize, byte_order,
- value_address (arg));
+ arg->address ());
typecode = TYPE_CODE_PTR;
len = abi_regsize;
val = ref_valbuf;
gdb_printf (gdb_stdlog, " push");
}
else
- val = value_contents (arg).data ();
+ val = arg->contents ().data ();
/* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
- arg_space += align_up (value_type (args[argnum])->length (),
+ arg_space += align_up (args[argnum]->type ()->length (),
MIPS64_REGSIZE);
sp -= align_up (arg_space, 16);
{
const gdb_byte *val;
struct value *arg = args[argnum];
- struct type *arg_type = check_typedef (value_type (arg));
+ struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
"mips_n32n64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode);
- val = value_contents (arg).data ();
+ val = arg->contents ().data ();
/* A 128-bit long double value requires an even-odd pair of
floating-point registers. */
From MIPSpro Assembly Language Programmer's Guide, Document Number:
007-2418-004
- Software
+ Software
Register Name(from
Name fgregdef.h) Use and Linkage
-----------------------------------------------------------------
$f0, $f2 fv0, fv1 Hold results of floating-point type function
- ($f0) and complex type function ($f0 has the
- real part, $f2 has the imaginary part.) */
+ ($f0) and complex type function ($f0 has the
+ real part, $f2 has the imaginary part.) */
if (type->length () > 2 * MIPS64_REGSIZE)
return RETURN_VALUE_STRUCT_CONVENTION;
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
{
- struct type *arg_type = check_typedef (value_type (args[argnum]));
+ struct type *arg_type = check_typedef (args[argnum]->type ());
/* Align to double-word if necessary. */
if (mips_type_needs_double_align (arg_type))
{
const gdb_byte *val;
struct value *arg = args[argnum];
- struct type *arg_type = check_typedef (value_type (arg));
+ struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
"mips_o32_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode);
- val = value_contents (arg).data ();
+ val = arg->contents ().data ();
/* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register
readbuf, writebuf, 4);
break;
default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
+ internal_error (_("bad switch"));
}
}
if (fval_reg != mips_fval_fpr)
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
{
- struct type *arg_type = check_typedef (value_type (args[argnum]));
+ struct type *arg_type = check_typedef (args[argnum]->type ());
/* Allocate space on the stack. */
arg_space += align_up (arg_type->length (), MIPS64_REGSIZE);
{
const gdb_byte *val;
struct value *arg = args[argnum];
- struct type *arg_type = check_typedef (value_type (arg));
+ struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
"mips_o64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode);
- val = value_contents (arg).data ();
+ val = arg->contents ().data ();
/* Floating point arguments passed in registers have to be
treated specially. On 32-bit architectures, doubles are
int rawnum = regno % gdbarch_num_regs (gdbarch);
if ((rawnum - mips_regnum (gdbarch)->fp0) & 1)
- internal_error (__FILE__, __LINE__,
- _("mips_read_fp_register_double: bad access to "
+ internal_error (_("mips_read_fp_register_double: bad access to "
"odd-numbered FP register"));
/* mips_read_fp_register_single will find the correct 32 bits from
/* OK: get the data in raw format. */
value = get_frame_register_value (frame, regnum);
- if (value_optimized_out (value)
- || !value_entirely_available (value))
+ if (value->optimized_out ()
+ || !value->entirely_available ())
{
gdb_printf (file, "%*s ",
(int) mips_abi_regsize (gdbarch) * 2,
col++;
continue;
}
- raw_buffer = value_contents_all (value).data ();
+ raw_buffer = value->contents_all ().data ();
/* pad small registers */
for (byte = 0;
byte < (mips_abi_regsize (gdbarch)
fpu = "absent (none)";
break;
default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
+ internal_error (_("bad switch"));
}
if (mips_fpu_type_auto)
gdb_printf ("The MIPS floating-point coprocessor "
instead of relying on globals. Doing that would let generic code
handle the search for this specific architecture. */
if (!gdbarch_update_p (info))
- internal_error (__FILE__, __LINE__, _("set mipsfpu failed"));
+ internal_error (_("set mipsfpu failed"));
}
static void
instead of relying on globals. Doing that would let generic code
handle the search for this specific architecture. */
if (!gdbarch_update_p (info))
- internal_error (__FILE__, __LINE__, _("set mipsfpu failed"));
+ internal_error (_("set mipsfpu failed"));
}
static void
instead of relying on globals. Doing that would let generic code
handle the search for this specific architecture. */
if (!gdbarch_update_p (info))
- internal_error (__FILE__, __LINE__, _("set mipsfpu failed"));
+ internal_error (_("set mipsfpu failed"));
}
static void
if (mips_abi_strings[i] == mips_abi_string)
return (enum mips_abi) i;
- internal_error (__FILE__, __LINE__, _("unknown ABI string"));
+ internal_error (_("unknown ABI string"));
}
/* Return the default compressed instruction set, either of MIPS16
if (mips_compression_strings[i] == mips_compression_string)
return (enum mips_isa) i;
- internal_error (__FILE__, __LINE__, _("unknown compressed ISA string"));
+ internal_error (_("unknown compressed ISA string"));
}
static void
static struct gdbarch *
mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch *gdbarch;
int elf_flags;
enum mips_abi mips_abi, found_abi, wanted_abi;
int i, num_regs;
}
/* Need a new architecture. Fill in a target specific vector. */
- mips_gdbarch_tdep *tdep = new mips_gdbarch_tdep;
- gdbarch = gdbarch_alloc (&info, tdep);
+ gdbarch *gdbarch
+ = gdbarch_alloc (&info, gdbarch_tdep_up (new mips_gdbarch_tdep));
+ mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
+
tdep->elf_flags = elf_flags;
tdep->mips64_transfers_32bit_regs_p = mips64_transfers_32bit_regs_p;
tdep->found_abi = found_abi;
set_gdbarch_long_double_format (gdbarch, floatformats_ibm_long_double);
break;
default:
- internal_error (__FILE__, __LINE__, _("unknown ABI in switch"));
+ internal_error (_("unknown ABI in switch"));
}
/* GCC creates a pseudo-section whose name specifies the size of
set_gdbarch_ptr_bit (gdbarch, long_bit);
break;
default:
- internal_error (__FILE__, __LINE__, _("unknown ABI in switch"));
+ internal_error (_("unknown ABI in switch"));
}
}
}
mips_abi_string = mips_abi_strings[MIPS_ABI_UNKNOWN];
if (MIPS_ABI_LAST + 1
!= sizeof (mips_abi_strings) / sizeof (mips_abi_strings[0]))
- internal_error (__FILE__, __LINE__, _("mips_abi_strings out of sync"));
+ internal_error (_("mips_abi_strings out of sync"));
gdbarch_register (bfd_arch_mips, mips_gdbarch_init, mips_dump_tdep);