X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fbfin-tdep.c;h=3fa81732c66d06ad1366964363b888f17219d26f;hb=2117c711ae07700adb57ea5b5ca61e4c32d7e3d2;hp=21213ab16ff247dcdeea9cde4fd229014cbe4dfb;hpb=0963b4bd458eab010b3b19c9ffd8eb790f2cd06c;p=deliverable%2Fbinutils-gdb.git
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 21213ab16f..3fa81732c6 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -1,7 +1,6 @@
/* Target-dependent code for Analog Devices Blackfin processor, for GDB.
- Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
@@ -21,7 +20,7 @@
along with this program. If not, see . */
#include "defs.h"
-#include "gdb_string.h"
+#include
#include "inferior.h"
#include "gdbcore.h"
#include "arch-utils.h"
@@ -32,6 +31,8 @@
#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"
#include "symtab.h"
#include "elf-bfd.h"
@@ -374,6 +375,7 @@ bfin_frame_prev_register (struct frame_info *this_frame,
static const struct frame_unwind bfin_frame_unwind =
{
NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
bfin_frame_this_id,
bfin_frame_prev_register,
NULL,
@@ -501,7 +503,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- char buf[4];
+ gdb_byte buf[4];
int i;
long reg_r0, reg_r1, reg_r2;
int total_len = 0;
@@ -511,9 +513,8 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
for (i = nargs - 1; i >= 0; i--)
{
struct type *value_type = value_enclosing_type (args[i]);
- int len = TYPE_LENGTH (value_type);
- total_len += (len + 3) & ~3;
+ total_len += (TYPE_LENGTH (value_type) + 3) & ~3;
}
/* At least twelve bytes of stack space must be allocated for the function's
@@ -529,8 +530,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
{
struct type *value_type = value_enclosing_type (args[i]);
struct type *arg_type = check_typedef (value_type);
- int len = TYPE_LENGTH (value_type);
- int container_len = (len + 3) & ~3;
+ int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
sp -= container_len;
write_memory (sp, value_contents_writeable (args[i]), container_len);
@@ -574,11 +574,11 @@ bfin_reg_to_regnum (struct gdbarch *gdbarch, int reg)
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. */
+/* This function implements the 'breakpoint_from_pc' gdbarch method.
+ 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. */
static const unsigned char *
bfin_breakpoint_from_pc (struct gdbarch *gdbarch,
@@ -620,7 +620,7 @@ bfin_extract_return_value (struct type *type,
while (len > 0)
{
regcache_cooked_read_unsigned (regs, regno++, &tmp);
- store_unsigned_integer (valbuf, (len > 4 ? 4 : len), tmp, byte_order);
+ store_unsigned_integer (valbuf, (len > 4 ? 4 : len), byte_order, tmp);
len -= 4;
valbuf += 4;
}
@@ -661,7 +661,7 @@ bfin_store_return_value (struct type *type,
static enum return_value_convention
bfin_return_value (struct gdbarch *gdbarch,
- struct type *func_type,
+ struct value *function,
struct type *type,
struct regcache *regcache,
gdb_byte *readbuf,
@@ -687,20 +687,25 @@ bfin_register_name (struct gdbarch *gdbarch, int i)
return bfin_register_name_strings[i];
}
-static void
+static enum register_status
bfin_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, gdb_byte *buffer)
{
gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+ enum register_status status;
if (regnum != BFIN_CC_REGNUM)
internal_error (__FILE__, __LINE__,
_("invalid register number %d"), regnum);
/* Extract the CC bit from the ASTAT register. */
- regcache_raw_read (regcache, BFIN_ASTAT_REGNUM, buf);
- buffer[1] = buffer[2] = buffer[3] = 0;
- buffer[0] = !!(buf[0] & ASTAT_CC);
+ status = regcache_raw_read (regcache, BFIN_ASTAT_REGNUM, buf);
+ if (status == REG_VALID)
+ {
+ buffer[1] = buffer[2] = buffer[3] = 0;
+ buffer[0] = !!(buf[0] & ASTAT_CC);
+ }
+ return status;
}
static void
@@ -813,7 +818,7 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
}
- tdep = XMALLOC (struct gdbarch_tdep);
+ tdep = XNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
tdep->bfin_abi = abi;