/* Target-dependent code for the Toshiba MeP for GDB, the GNU debugger.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
#include "prologue-value.h"
#include "cgen/bitset.h"
#include "infcall.h"
+#include "gdbarch.h"
/* Get the user's customized MeP coprocessor register names from
libopcodes. */
options are present on the current processor. */
-struct gdbarch_tdep
+struct mep_gdbarch_tdep : gdbarch_tdep
{
/* A CGEN cpu descriptor for this BFD architecture and machine.
MeP libopcodes machinery actually puts off module-specific
customization until the last minute. So this contains
information about all supported me_modules. */
- CGEN_CPU_DESC cpu_desc;
+ CGEN_CPU_DESC cpu_desc = nullptr;
/* The me_module index from the ELF file we used to select this
architecture, or CONFIG_NONE if there was none.
create a separate instance of the gdbarch structure for each
me_module value mep_gdbarch_init sees, and store the me_module
value from the ELF file here. */
- CONFIG_ATTR me_module;
+ CONFIG_ATTR me_module {};
};
mask contains any of the me_module's coprocessor ISAs,
specifically excluding the generic coprocessor register sets. */
- CGEN_CPU_DESC desc = gdbarch_tdep (target_gdbarch ())->cpu_desc;
+ mep_gdbarch_tdep *tdep
+ = (mep_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
+ CGEN_CPU_DESC desc = tdep->cpu_desc;
const CGEN_HW_ENTRY *hw;
if (me_module == CONFIG_NONE)
We just list the register numbers here explicitly to help catch
typos. */
#define CSR(name) MEP_RAW_ ## name ## _REGNUM, MEP_ ## name ## _REGNUM
-struct mep_csr_register mep_csr_registers[] = {
+static mep_csr_register mep_csr_registers[] = {
{ CSR(PC), 0xffffffff }, /* manual says r/o, but we can write it */
{ CSR(LP), 0xffffffff },
{ CSR(SAR), 0x0000003f },
return (CONFIG_ATTR) regval;
}
else
- return gdbarch_tdep (target_gdbarch ())->me_module;
+ {
+ mep_gdbarch_tdep *tdep
+ = (mep_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
+ return tdep->me_module;
+ }
}
static const struct frame_unwind mep_frame_unwind = {
+ "mep prologue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
mep_frame_this_id,
/* Reserve space for the copy, and then round the SP down, to
make sure it's all aligned properly. */
sp = (sp - arg_len) & -4;
- write_memory (sp, value_contents (argv[i]), arg_len);
+ write_memory (sp, value_contents (argv[i]).data (), arg_len);
copy[i] = sp;
}
}
/* Arguments that fit in a GPR get expanded to fill the GPR. */
if (TYPE_LENGTH (value_type (argv[i])) <= MEP_GPR_SIZE)
- value = extract_unsigned_integer (value_contents (argv[i]),
+ value = extract_unsigned_integer (value_contents (argv[i]).data (),
TYPE_LENGTH (value_type (argv[i])),
byte_order);
mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
/* Which me_module are we building a gdbarch object for? */
CONFIG_ATTR me_module;
const char *file_endianness
= bfd_big_endian (info.abfd) ? "big" : "little";
- fputc_unfiltered ('\n', gdb_stderr);
+ gdb_putc ('\n', gdb_stderr);
if (module_name)
warning (_("the MeP module '%s' is %s-endian, but the executable\n"
"%s is %s-endian."),
for (arches = gdbarch_list_lookup_by_info (arches, &info);
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
- if (gdbarch_tdep (arches->gdbarch)->me_module == me_module)
- return arches->gdbarch;
+ {
+ mep_gdbarch_tdep *tdep
+ = (mep_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
+
+ if (tdep->me_module == me_module)
+ return arches->gdbarch;
+ }
- tdep = XCNEW (struct gdbarch_tdep);
+ mep_gdbarch_tdep *tdep = new mep_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Get a CGEN CPU descriptor for this architecture. */