/* Target dependent code for ARC architecture, for GDB.
- Copyright 2005-2021 Free Software Foundation, Inc.
+ Copyright 2005-2022 Free Software Foundation, Inc.
Contributed by Synopsys Inc.
This file is part of GDB.
/* JLI and EI depend on optional AUX registers. Not supported right now. */
else if (insn.insn_class == JLI)
{
- fprintf_unfiltered (gdb_stderr,
- "JLI_S instruction is not supported by the GDB.");
+ gdb_printf (gdb_stderr,
+ "JLI_S instruction is not supported by the GDB.");
return 0;
}
else if (insn.insn_class == EI)
{
- fprintf_unfiltered (gdb_stderr,
- "EI_S instruction is not supported by the GDB.");
+ gdb_printf (gdb_stderr,
+ "EI_S instruction is not supported by the GDB.");
return 0;
}
/* LEAVE_S: PC = BLINK. */
unsigned int len = TYPE_LENGTH (value_type (args[i]));
unsigned int space = align_up (len, 4);
- memcpy (data, value_contents (args[i]), (size_t) len);
+ memcpy (data, value_contents (args[i]).data (), (size_t) len);
arc_debug_printf ("copying arg %d, val 0x%08x, len %d to mem",
- i, *((int *) value_contents (args[i])), len);
+ i, *((int *) value_contents (args[i]).data ()),
+ len);
data += space;
}
arc_debug_printf ("called");
struct gdbarch *gdbarch = get_frame_arch (frame);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int pc_offset = tdep->jb_pc * ARC_REGISTER_SIZE;
gdb_byte buf[ARC_REGISTER_SIZE];
CORE_ADDR jb_addr = get_frame_register_unsigned (frame, ARC_FIRST_ARG_REGNUM);
return false;
}
-/* Copy of gdb_buffered_insn_length_fprintf from disasm.c. */
-
-static int ATTRIBUTE_PRINTF (2, 3)
-arc_fprintf_disasm (void *stream, const char *format, ...)
-{
- return 0;
-}
+/* See arc-tdep.h. */
struct disassemble_info
arc_disassemble_info (struct gdbarch *gdbarch)
{
struct disassemble_info di;
- init_disassemble_info (&di, &null_stream, arc_fprintf_disasm);
+ init_disassemble_info_for_no_printing (&di);
di.arch = gdbarch_bfd_arch_info (gdbarch)->arch;
di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
di.endian = gdbarch_byte_order (gdbarch);
{
arc_debug_printf ("called");
- struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
+ gdbarch *arch = get_frame_arch (this_frame);
+ arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (arch);
/* Allocate new frame cache instance and space for saved register info. */
struct arc_frame_cache *cache = FRAME_OBSTACK_ZALLOC (struct arc_frame_cache);
struct frame_info *this_frame,
void **this_cache)
{
- struct gdbarch_tdep *tdep;
-
arc_debug_printf ("called");
- tdep = gdbarch_tdep (get_frame_arch (this_frame));
+ gdbarch *arch = get_frame_arch (this_frame);
+ arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (arch);
/* If we have a sigcontext_addr handler, then just return 1 (same as the
"default_frame_sniffer ()"). */
accepts the frame. */
static const struct frame_unwind arc_frame_unwind = {
+ "arc prologue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
arc_frame_this_id,
context. */
static const struct frame_unwind arc_sigtramp_frame_unwind = {
+ "arc sigtramp",
SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
arc_sigtramp_frame_this_id,
arc_frame_base_address
};
-/* Add all the expected register sets into GDBARCH. */
-
-static void
-arc_add_reggroups (struct gdbarch *gdbarch)
-{
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
-}
-
static enum arc_isa
mach_type_to_arc_isa (const unsigned long mach)
{
/* Allocate the ARC-private target-dependent information structure, and the
GDB target-independent information structure. */
- gdb::unique_xmalloc_ptr<struct gdbarch_tdep> tdep
- (XCNEW (struct gdbarch_tdep));
+ std::unique_ptr<arc_gdbarch_tdep> tdep_holder (new arc_gdbarch_tdep);
+ arc_gdbarch_tdep *tdep = tdep_holder.get ();
tdep->jb_pc = -1; /* No longjmp support by default. */
tdep->has_hw_loops = arc_check_for_hw_loops (tdesc, tdesc_data.get ());
- struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep.release ());
+ struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep_holder.release ());
/* Data types. */
set_gdbarch_short_bit (gdbarch, 16);
/* This doesn't include possible long-immediate value. */
set_gdbarch_max_insn_length (gdbarch, 4);
- /* Add default register groups. */
- arc_add_reggroups (gdbarch);
-
/* Frame unwinders and sniffers. */
dwarf2_frame_set_init_reg (gdbarch, arc_dwarf2_frame_init_reg);
dwarf2_append_unwinders (gdbarch);
It can override functions set earlier. */
gdbarch_init_osabi (info, gdbarch);
- if (gdbarch_tdep (gdbarch)->jb_pc >= 0)
+ if (tdep->jb_pc >= 0)
set_gdbarch_get_longjmp_target (gdbarch, arc_get_longjmp_target);
/* Disassembler options. Enforce CPU if it was specified in XML target
arc_disassembler_options = NULL;
break;
}
- set_gdbarch_disassembler_options (gdbarch,
- &arc_disassembler_options);
}
}
+ set_gdbarch_disassembler_options (gdbarch, &arc_disassembler_options);
+ set_gdbarch_valid_disassembler_options (gdbarch,
+ disassembler_options_arc ());
+
tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
return gdbarch;
static void
arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- fprintf_unfiltered (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);
-
- fprintf_unfiltered (file, "arc_dump_tdep: is_sigtramp = <%s>\n",
- host_address_to_string (tdep->is_sigtramp));
- fprintf_unfiltered (file, "arc_dump_tdep: sigcontext_addr = <%s>\n",
- host_address_to_string (tdep->sigcontext_addr));
- fprintf_unfiltered (file, "arc_dump_tdep: sc_reg_offset = <%s>\n",
- host_address_to_string (tdep->sc_reg_offset));
- fprintf_unfiltered (file, "arc_dump_tdep: sc_num_regs = %d\n",
- tdep->sc_num_regs);
+ arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+
+ gdb_printf (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);
+
+ gdb_printf (file, "arc_dump_tdep: is_sigtramp = <%s>\n",
+ host_address_to_string (tdep->is_sigtramp));
+ gdb_printf (file, "arc_dump_tdep: sigcontext_addr = <%s>\n",
+ host_address_to_string (tdep->sigcontext_addr));
+ gdb_printf (file, "arc_dump_tdep: sc_reg_offset = <%s>\n",
+ host_address_to_string (tdep->sc_reg_offset));
+ gdb_printf (file, "arc_dump_tdep: sc_num_regs = %d\n",
+ tdep->sc_num_regs);
}
/* This command accepts single argument - address of instruction to
add_show_prefix_cmd ("arc", class_maintenance,
_("ARC-specific maintenance commands for printing GDB "
"internal state."),
- &maintenance_print_arc_list, "maintenance print arc ",
+ &maintenance_print_arc_list,
0, &maintenanceprintlist);
add_cmd ("arc-instruction", class_maintenance,