/* Target-dependent code for Moxie.
- Copyright (C) 2009-2021 Free Software Foundation, Inc.
+ Copyright (C) 2009-2023 Free Software Foundation, Inc.
This file is part of GDB.
static const char *
moxie_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- if (reg_nr < 0)
- return NULL;
- if (reg_nr >= MOXIE_NUM_REGS)
- return NULL;
+ gdb_static_assert (ARRAY_SIZE (moxie_register_names) == MOXIE_NUM_REGS);
return moxie_register_names[reg_nr];
}
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR regval;
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
/* Things always get returned in RET1_REGNUM, RET2_REGNUM. */
regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len, byte_order);
if (target_read_memory (addr, buf, length))
{
if (record_debug)
- printf_unfiltered (_("Process record: error reading memory at "
- "addr 0x%s len = %d.\n"),
- paddress (target_gdbarch (), addr), length);
+ gdb_printf (gdb_stderr,
+ _("Process record: error reading memory at "
+ "addr 0x%s len = %d.\n"),
+ paddress (target_gdbarch (), addr), length);
return -1;
}
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
ULONGEST tmp;
/* By using store_unsigned_integer we avoid having to do
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (TYPE_LENGTH (valtype) > 8)
+ if (valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{
/* Populate a moxie_frame_cache object for this_frame. */
static struct moxie_frame_cache *
-moxie_frame_cache (struct frame_info *this_frame, void **this_cache)
+moxie_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct moxie_frame_cache *cache;
CORE_ADDR current_pc;
frame. This will be used to create a new GDB frame struct. */
static void
-moxie_frame_this_id (struct frame_info *this_frame,
+moxie_frame_this_id (frame_info_ptr this_frame,
void **this_prologue_cache, struct frame_id *this_id)
{
struct moxie_frame_cache *cache = moxie_frame_cache (this_frame,
/* Get the value of register regnum in the previous stack frame. */
static struct value *
-moxie_frame_prev_register (struct frame_info *this_frame,
+moxie_frame_prev_register (frame_info_ptr this_frame,
void **this_prologue_cache, int regnum)
{
struct moxie_frame_cache *cache = moxie_frame_cache (this_frame,
}
static const struct frame_unwind moxie_frame_unwind = {
+ "moxie prologue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
moxie_frame_this_id,
/* Return the base address of this_frame. */
static CORE_ADDR
-moxie_frame_base_address (struct frame_info *this_frame, void **this_cache)
+moxie_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
struct moxie_frame_cache *cache = moxie_frame_cache (this_frame,
this_cache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (record_debug > 1)
- fprintf_unfiltered (gdb_stdlog, "Process record: moxie_process_record "
- "addr = 0x%s\n",
- paddress (target_gdbarch (), addr));
+ gdb_printf (gdb_stdlog, "Process record: moxie_process_record "
+ "addr = 0x%s\n",
+ paddress (target_gdbarch (), addr));
inst = (uint16_t) moxie_process_readu (addr, buf, 2, byte_order);
static struct gdbarch *
moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
-
/* If there is already a candidate, use it. */
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
/* Allocate space for the new architecture. */
- tdep = XCNEW (struct gdbarch_tdep);
- gdbarch = gdbarch_alloc (&info, tdep);
+ gdbarch *gdbarch
+ = gdbarch_alloc (&info, gdbarch_tdep_up (new moxie_gdbarch_tdep));
set_gdbarch_wchar_bit (gdbarch, 32);
set_gdbarch_wchar_signed (gdbarch, 0);
void
_initialize_moxie_tdep ()
{
- register_gdbarch_init (bfd_arch_moxie, moxie_gdbarch_init);
+ gdbarch_register (bfd_arch_moxie, moxie_gdbarch_init);
}