/* Target-dependent code for Analog Devices Blackfin processor, for GDB.
- Copyright (C) 2005-2012 Free Software Foundation, Inc.
+ Copyright (C) 2005-2016 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "gdb_string.h"
#include "inferior.h"
#include "gdbcore.h"
#include "arch-utils.h"
#include "frame-base.h"
#include "trad-frame.h"
#include "dis-asm.h"
-#include "gdb_assert.h"
#include "sim-regno.h"
#include "gdb/sim-bfin.h"
#include "dwarf2-frame.h"
int i;
if (*this_cache)
- return *this_cache;
+ return (struct bfin_frame_cache *) *this_cache;
cache = bfin_alloc_frame_cache ();
*this_cache = cache;
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- char buf[4];
int i;
long reg_r0, reg_r1, reg_r2;
int total_len = 0;
- enum bfin_abi abi = bfin_abi (gdbarch);
- CORE_ADDR func_addr = find_function_addr (function, NULL);
for (i = nargs - 1; i >= 0; i--)
{
int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
sp -= container_len;
- write_memory (sp, value_contents_writeable (args[i]), container_len);
+ write_memory (sp, value_contents (args[i]), container_len);
}
/* Initialize R0, R1, and R2 to the first 3 words of parameters. */
static int
bfin_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
- if (reg > ARRAY_SIZE (map_gcc_gdb))
- return 0;
+ if (reg < 0 || reg >= ARRAY_SIZE (map_gcc_gdb))
+ return -1;
return map_gcc_gdb[reg];
}
-/* This function implements the BREAKPOINT_FROM_PC macro. It returns
- a pointer to a string of bytes that encode a breakpoint instruction,
- stores the length of the string to *lenptr, and adjusts the program
- counter (if necessary) to point to the actual memory location where
- the breakpoint should be inserted. */
+/* Implement the breakpoint_kind_from_pc gdbarch method. */
-static const unsigned char *
-bfin_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
+static int
+bfin_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned short iw;
- static unsigned char bfin_breakpoint[] = {0xa1, 0x00, 0x00, 0x00};
- static unsigned char bfin_sim_breakpoint[] = {0x25, 0x00, 0x00, 0x00};
iw = read_memory_unsigned_integer (*pcptr, 2, byte_order);
if ((iw & 0xf000) >= 0xc000)
/* 32-bit instruction. */
- *lenptr = 4;
+ return 4;
else
- *lenptr = 2;
+ return 2;
+}
+
+/* Implement the sw_breakpoint_from_kind gdbarch method. */
+
+static const gdb_byte *
+bfin_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
+{
+ static unsigned char bfin_breakpoint[] = {0xa1, 0x00, 0x00, 0x00};
+ static unsigned char bfin_sim_breakpoint[] = {0x25, 0x00, 0x00, 0x00};
+
+ *size = kind;
if (strcmp (target_shortname, "sim") == 0)
return bfin_sim_breakpoint;
ULONGEST tmp;
int regno = BFIN_R0_REGNUM;
- gdb_assert (TYPE_LENGTH (type) <= 8);
+ gdb_assert (len <= 8);
while (len > 0)
{
int len = TYPE_LENGTH (type);
int regno = BFIN_R0_REGNUM;
- gdb_assert (TYPE_LENGTH (type) <= 8);
+ gdb_assert (len <= 8);
while (len > 0)
{
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
- int elf_flags;
enum bfin_abi abi;
- /* Extract the ELF flags, if available. */
- if (info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
- elf_flags = elf_elfheader (info.abfd)->e_flags;
- else
- elf_flags = 0;
-
abi = BFIN_ABI_FLAT;
/* If there is already a candidate, use it. */
return arches->gdbarch;
}
- tdep = XMALLOC (struct gdbarch_tdep);
+ tdep = XNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
tdep->bfin_abi = abi;
set_gdbarch_return_value (gdbarch, bfin_return_value);
set_gdbarch_skip_prologue (gdbarch, bfin_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, bfin_breakpoint_from_pc);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, bfin_breakpoint_kind_from_pc);
+ 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);