/* Target-dependent code for the 32-bit OpenRISC 1000, for the GDB.
- Copyright (C) 2008-2022 Free Software Foundation, Inc.
+ Copyright (C) 2008-2023 Free Software Foundation, Inc.
This file is part of GDB.
show_or1k_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("OpenRISC debugging is %s.\n"), value);
+ gdb_printf (file, _("OpenRISC debugging is %s.\n"), value);
}
/* The target-dependent structure for gdbarch. */
-struct or1k_gdbarch_tdep : gdbarch_tdep
+struct or1k_gdbarch_tdep : gdbarch_tdep_base
{
int bytes_per_word = 0;
int bytes_per_address = 0;
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code rv_type = valtype->code ();
- unsigned int rv_size = TYPE_LENGTH (valtype);
- or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ unsigned int rv_size = valtype->length ();
+ or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
int bpw = tdep->bytes_per_word;
/* Deal with struct/union as addresses. If an array won't fit in a
{
const CGEN_INSN *insn;
CGEN_FIELDS tmp_fields;
- or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
insn = cgen_lookup_insn (tdep->gdb_cgen_cpu_desc,
NULL,
static int
or1k_single_step_through_delay (struct gdbarch *gdbarch,
- struct frame_info *this_frame)
+ frame_info_ptr this_frame)
{
ULONGEST val;
CORE_ADDR ppc;
{
struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
struct compunit_symtab *compunit
- = SYMTAB_COMPUNIT (prologue_sal.symtab);
- const char *debug_format = COMPUNIT_DEBUGFORMAT (compunit);
+ = prologue_sal.symtab->compunit ();
+ const char *debug_format = compunit->debugformat ();
if ((NULL != debug_format)
&& (strlen ("dwarf") <= strlen (debug_format))
/* Implement the unwind_pc gdbarch method. */
static CORE_ADDR
-or1k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
+or1k_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
CORE_ADDR pc;
if (or1k_debug)
- fprintf_unfiltered (gdb_stdlog, "or1k_unwind_pc, next_frame=%d\n",
- frame_relative_level (next_frame));
+ gdb_printf (gdb_stdlog, "or1k_unwind_pc, next_frame=%d\n",
+ frame_relative_level (next_frame));
pc = frame_unwind_register_unsigned (next_frame, OR1K_NPC_REGNUM);
if (or1k_debug)
- fprintf_unfiltered (gdb_stdlog, "or1k_unwind_pc, pc=%s\n",
- paddress (gdbarch, pc));
+ gdb_printf (gdb_stdlog, "or1k_unwind_pc, pc=%s\n",
+ paddress (gdbarch, pc));
return pc;
}
/* Implement the unwind_sp gdbarch method. */
static CORE_ADDR
-or1k_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
+or1k_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
CORE_ADDR sp;
if (or1k_debug)
- fprintf_unfiltered (gdb_stdlog, "or1k_unwind_sp, next_frame=%d\n",
- frame_relative_level (next_frame));
+ gdb_printf (gdb_stdlog, "or1k_unwind_sp, next_frame=%d\n",
+ frame_relative_level (next_frame));
sp = frame_unwind_register_unsigned (next_frame, OR1K_SP_REGNUM);
if (or1k_debug)
- fprintf_unfiltered (gdb_stdlog, "or1k_unwind_sp, sp=%s\n",
- paddress (gdbarch, sp));
+ gdb_printf (gdb_stdlog, "or1k_unwind_sp, sp=%s\n",
+ paddress (gdbarch, sp));
return sp;
}
int heap_offset = 0;
CORE_ADDR heap_sp = sp - 128;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
int bpa = tdep->bytes_per_address;
int bpw = tdep->bytes_per_word;
struct type *func_type = value_type (function);
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
- int len = TYPE_LENGTH (arg_type);
+ int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if (func_type->has_varargs () && argnum >= func_type->num_fields ())
{
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
- int len = TYPE_LENGTH (arg_type);
+ int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode)
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
- int len = TYPE_LENGTH (arg_type);
+ int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
/* The EABI passes structures that do not fit in a register by
reference. In all other cases, pass the structure by value. */
Reportedly, this is only valid for frames less than 0x7fff in size. */
static struct trad_frame_cache *
-or1k_frame_cache (struct frame_info *this_frame, void **prologue_cache)
+or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
{
struct gdbarch *gdbarch;
struct trad_frame_cache *info;
CORE_ADDR end_addr;
if (or1k_debug)
- fprintf_unfiltered (gdb_stdlog,
- "or1k_frame_cache, prologue_cache = %s\n",
- host_address_to_string (*prologue_cache));
+ gdb_printf (gdb_stdlog,
+ "or1k_frame_cache, prologue_cache = %s\n",
+ host_address_to_string (*prologue_cache));
/* Nothing to do if we already have this info. */
if (NULL != *prologue_cache)
if (start_addr == 0)
{
if (or1k_debug)
- fprintf_unfiltered (gdb_stdlog, " couldn't find function\n");
+ gdb_printf (gdb_stdlog, " couldn't find function\n");
/* JPB: 28-Apr-11. This is a temporary patch, to get round GDB
crashing right at the beginning. Build the frame ID as best we
if (or1k_debug)
{
- fprintf_unfiltered (gdb_stdlog, " this_sp_for_id = %s\n",
- paddress (gdbarch, this_sp_for_id));
- fprintf_unfiltered (gdb_stdlog, " start_addr = %s\n",
- paddress (gdbarch, start_addr));
+ gdb_printf (gdb_stdlog, " this_sp_for_id = %s\n",
+ paddress (gdbarch, this_sp_for_id));
+ gdb_printf (gdb_stdlog, " start_addr = %s\n",
+ paddress (gdbarch, start_addr));
}
return info;
/* Implement the this_id function for the stub unwinder. */
static void
-or1k_frame_this_id (struct frame_info *this_frame,
+or1k_frame_this_id (frame_info_ptr this_frame,
void **prologue_cache, struct frame_id *this_id)
{
struct trad_frame_cache *info = or1k_frame_cache (this_frame,
/* Implement the prev_register function for the stub unwinder. */
static struct value *
-or1k_frame_prev_register (struct frame_info *this_frame,
+or1k_frame_prev_register (frame_info_ptr this_frame,
void **prologue_cache, int regnum)
{
struct trad_frame_cache *info = or1k_frame_cache (this_frame,
static struct gdbarch *
or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch *gdbarch;
const struct bfd_arch_info *binfo;
tdesc_arch_data_up tdesc_data;
const struct target_desc *tdesc = info.target_desc;
actually know which target we are talking to, but put in some defaults
for now. */
binfo = info.bfd_arch_info;
- or1k_gdbarch_tdep *tdep = new or1k_gdbarch_tdep;
+ gdbarch *gdbarch
+ = gdbarch_alloc (&info, gdbarch_tdep_up (new or1k_gdbarch_tdep));
+ or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
+
tdep->bytes_per_word = binfo->bits_per_word / binfo->bits_per_byte;
tdep->bytes_per_address = binfo->bits_per_address / binfo->bits_per_byte;
- gdbarch = gdbarch_alloc (&info, tdep);
/* Target data types */
set_gdbarch_short_bit (gdbarch, 16);
}
if (tdesc_data != NULL)
- {
- /* If we are using tdesc, register our own reggroups, otherwise we
- will used the defaults. */
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
-
- tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
- }
+ tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
static void
or1k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
if (NULL == tdep)
return; /* Nothing to report */
- fprintf_filtered (file, "or1k_dump_tdep: %d bytes per word\n",
- tdep->bytes_per_word);
- fprintf_filtered (file, "or1k_dump_tdep: %d bytes per address\n",
- tdep->bytes_per_address);
+ gdb_printf (file, "or1k_dump_tdep: %d bytes per word\n",
+ tdep->bytes_per_word);
+ gdb_printf (file, "or1k_dump_tdep: %d bytes per address\n",
+ tdep->bytes_per_address);
}
\f