/* Target-dependent code for Analog Devices Blackfin processor, for GDB.
- Copyright (C) 2005-2018 Free Software Foundation, Inc.
+ Copyright (C) 2005-2022 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
#include "dis-asm.h"
#include "sim-regno.h"
#include "gdb/sim-bfin.h"
-#include "dwarf2-frame.h"
+#include "dwarf2/frame.h"
#include "symtab.h"
#include "elf-bfd.h"
#include "elf/bfin.h"
static const struct frame_unwind bfin_frame_unwind =
{
+ "bfin prologue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
bfin_frame_this_id,
int nargs,
struct value **args,
CORE_ADDR sp,
- int struct_return,
+ function_call_return_method return_method,
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
{
struct type *value_type = value_enclosing_type (args[i]);
- total_len += (TYPE_LENGTH (value_type) + 3) & ~3;
+ total_len += align_up (TYPE_LENGTH (value_type), 4);
}
/* At least twelve bytes of stack space must be allocated for the function's
{
struct type *value_type = value_enclosing_type (args[i]);
struct type *arg_type = check_typedef (value_type);
- int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
+ int container_len = align_up (TYPE_LENGTH (arg_type), 4);
sp -= container_len;
- write_memory (sp, value_contents (args[i]), container_len);
+ write_memory (sp, value_contents (args[i]).data (), container_len);
}
/* Initialize R0, R1, and R2 to the first 3 words of parameters. */
/* Store struct value address. */
- if (struct_return)
+ if (return_method == return_method_struct)
regcache_cooked_write_unsigned (regcache, BFIN_P0_REGNUM, struct_addr);
/* Set the dummy return value to bp_addr.
*size = kind;
- if (strcmp (target_shortname, "sim") == 0)
+ if (strcmp (target_shortname (), "sim") == 0)
return bfin_sim_breakpoint;
else
return bfin_breakpoint;
while (len > 0)
{
- regcache_cooked_write (regs, regno++, valbuf);
+ regs->cooked_write (regno++, valbuf);
len -= 4;
valbuf += 4;
}
bfin_frame_args_address
};
-static struct frame_id
-bfin_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
- CORE_ADDR sp;
-
- sp = get_frame_register_unsigned (this_frame, BFIN_SP_REGNUM);
-
- return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-static CORE_ADDR
-bfin_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
- return frame_unwind_register_unsigned (next_frame, BFIN_PC_REGNUM);
-}
-
static CORE_ADDR
bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
{
- return (address & ~0x3);
+ return align_down (address, 4);
}
enum bfin_abi
bfin_abi (struct gdbarch *gdbarch)
{
- return gdbarch_tdep (gdbarch)->bfin_abi;
+ bfin_gdbarch_tdep *tdep = gdbarch_tdep<bfin_gdbarch_tdep> (gdbarch);
+ return tdep->bfin_abi;
}
/* Initialize the current architecture based on INFO. If possible,
static struct gdbarch *
bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
enum bfin_abi abi;
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- if (gdbarch_tdep (arches->gdbarch)->bfin_abi != abi)
+ bfin_gdbarch_tdep *tdep
+ = gdbarch_tdep<bfin_gdbarch_tdep> (arches->gdbarch);
+
+ if (tdep->bfin_abi != abi)
continue;
+
return arches->gdbarch;
}
- tdep = XCNEW (struct gdbarch_tdep);
+ bfin_gdbarch_tdep *tdep = new bfin_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->bfin_abi = abi;
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, bfin_reg_to_regnum);
set_gdbarch_register_name (gdbarch, bfin_register_name);
set_gdbarch_register_type (gdbarch, bfin_register_type);
- set_gdbarch_dummy_id (gdbarch, bfin_dummy_id);
set_gdbarch_push_dummy_call (gdbarch, bfin_push_dummy_call);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_return_value (gdbarch, bfin_return_value);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, bfin_sw_breakpoint_from_kind);
set_gdbarch_decr_pc_after_break (gdbarch, 2);
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_unwind_pc (gdbarch, bfin_unwind_pc);
set_gdbarch_frame_align (gdbarch, bfin_frame_align);
/* Hook in ABI-specific overrides, if they have been registered. */
return gdbarch;
}
+void _initialize_bfin_tdep ();
void
-_initialize_bfin_tdep (void)
+_initialize_bfin_tdep ()
{
register_gdbarch_init (bfd_arch_bfin, bfin_gdbarch_init);
}