X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Flm32-tdep.c;h=3cd93381bdd787e6ef18b34b58039c8588223839;hb=545e07dffdaf1b79497a866772caf0dd6e0a243f;hp=3ac7f89d5d971a4661d4dbf6f7b511110a33d2ef;hpb=ecd75fc8eed3bde86036141228074a20e55dcfc9;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index 3ac7f89d5d..3cd93381bd 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -1,7 +1,7 @@ /* Target-dependent code for Lattice Mico32 processor, for GDB. Contributed by Jon Beniston - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -36,8 +36,7 @@ #include "trad-frame.h" #include "reggroups.h" #include "opcodes/lm32-desc.h" - -#include +#include /* Macros to extract fields from an instruction. */ #define LM32_OPCODE(insn) ((insn >> 26) & 0x3f) @@ -199,7 +198,7 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) CORE_ADDR post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr); if (post_prologue_pc != 0) - return max (pc, post_prologue_pc); + return std::max (pc, post_prologue_pc); } /* Can't determine prologue from the symbol table, need to examine @@ -217,16 +216,10 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) } /* Create a breakpoint instruction. */ +constexpr gdb_byte lm32_break_insn[4] = { OP_RAISE << 2, 0, 0, 2 }; -static const gdb_byte * -lm32_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, - int *lenptr) -{ - static const gdb_byte breakpoint[4] = { OP_RAISE << 2, 0, 0, 2 }; +typedef BP_MANIPULATION (lm32_break_insn) lm32_breakpoint; - *lenptr = sizeof (breakpoint); - return breakpoint; -} /* Setup registers and stack for faking a call to a function in the inferior. */ @@ -291,7 +284,8 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val); else { - write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type)); + write_memory_unsigned_integer (sp, TYPE_LENGTH (arg_type), byte_order, + val); sp -= 4; } } @@ -424,7 +418,7 @@ lm32_frame_cache (struct frame_info *this_frame, void **this_prologue_cache) int i; if ((*this_prologue_cache)) - return (*this_prologue_cache); + return (struct lm32_frame_cache *) (*this_prologue_cache); info = FRAME_OBSTACK_ZALLOC (struct lm32_frame_cache); (*this_prologue_cache) = info; @@ -527,7 +521,7 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; /* None found, create a new architecture from the information provided. */ - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); /* Type sizes. */ @@ -563,7 +557,8 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind); /* Breakpoints. */ - set_gdbarch_breakpoint_from_pc (gdbarch, lm32_breakpoint_from_pc); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, lm32_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, lm32_breakpoint::bp_from_kind); set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1); /* Calling functions in the inferior. */