X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=gdb%2Fmicroblaze-tdep.c;h=6b1c2ec753796edcdc5804bb2ee03bb3571fd221;hb=e2882c85786571175a0b0bfc3bcd2f14620b1ea3;hp=80c79f6bb3e3cf4f03994bc57f92a5624acb60e4;hpb=dccbb60975cdbcd6a906a79d0c4308b040fdac1b;p=thirdparty%2Fbinutils-gdb.git diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 80c79f6bb3e..6b1c2ec7537 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for Xilinx MicroBlaze. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This file is part of GDB. @@ -33,7 +33,6 @@ #include "frame-unwind.h" #include "dwarf2-frame.h" #include "osabi.h" -#include #include "target-descriptions.h" #include "opcodes/microblaze-opcm.h" #include "opcodes/microblaze-dis.h" @@ -83,7 +82,7 @@ static const char *microblaze_register_names[] = static unsigned int microblaze_debug_flag = 0; -static void +static void ATTRIBUTE_PRINTF (1, 2) microblaze_debug (const char *fmt, ...) { if (microblaze_debug_flag) @@ -135,39 +134,10 @@ microblaze_fetch_instruction (CORE_ADDR pc) return extract_unsigned_integer (buf, 4, byte_order); } +constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; -static CORE_ADDR -microblaze_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, - CORE_ADDR funcaddr, - struct value **args, int nargs, - struct type *value_type, - CORE_ADDR *real_pc, CORE_ADDR *bp_addr, - struct regcache *regcache) -{ - error (_("push_dummy_code not implemented")); - return sp; -} - - -static CORE_ADDR -microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - struct regcache *regcache, CORE_ADDR bp_addr, - int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) -{ - error (_("store_arguments not implemented")); - return sp; -} - -static const gdb_byte * -microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, - int *len) -{ - static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT; +typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; - *len = sizeof (break_insn); - return break_insn; -} /* Allocate and initialize a frame cache. */ @@ -462,11 +432,10 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) { struct microblaze_frame_cache *cache; struct gdbarch *gdbarch = get_frame_arch (next_frame); - CORE_ADDR func; int rn; if (*this_cache) - return *this_cache; + return (struct microblaze_frame_cache *) *this_cache; cache = microblaze_alloc_frame_cache (); *this_cache = cache; @@ -476,7 +445,8 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) for (rn = 0; rn < gdbarch_num_regs (gdbarch); rn++) cache->register_offsets[rn] = -1; - func = get_frame_func (next_frame); + /* Call for side effects. */ + get_frame_func (next_frame); cache->pc = get_frame_address_in_block (next_frame); @@ -663,8 +633,9 @@ static int dwarf2_to_reg_map[78] = static int microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) { - gdb_assert ((size_t) reg < sizeof (dwarf2_to_reg_map)); - return dwarf2_to_reg_map[reg]; + if (reg >= 0 && reg < sizeof (dwarf2_to_reg_map)) + return dwarf2_to_reg_map[reg]; + return -1; } static void @@ -723,10 +694,16 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) MICROBLAZE_SHR_REGNUM, "rshr"); } - } + + if (!valid_p) + { + tdesc_data_cleanup (tdesc_data); + return NULL; + } + } /* Allocate space for the new architecture. */ - tdep = XNEW (struct gdbarch_tdep); + tdep = XCNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); set_gdbarch_long_double_bit (gdbarch, 128); @@ -744,8 +721,6 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Call dummy code. */ set_gdbarch_call_dummy_location (gdbarch, ON_STACK); - set_gdbarch_push_dummy_code (gdbarch, microblaze_push_dummy_code); - set_gdbarch_push_dummy_call (gdbarch, microblaze_push_dummy_call); set_gdbarch_return_value (gdbarch, microblaze_return_value); set_gdbarch_stabs_argument_has_addr @@ -756,12 +731,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + microblaze_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + microblaze_breakpoint::bp_from_kind); set_gdbarch_frame_args_skip (gdbarch, 8); - set_gdbarch_print_insn (gdbarch, print_insn_microblaze); - set_gdbarch_write_pc (gdbarch, microblaze_write_pc); set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); @@ -783,9 +759,6 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return gdbarch; } -/* Provide a prototype to silence -Wmissing-prototypes. */ -void _initialize_microblaze_tdep (void); - void _initialize_microblaze_tdep (void) {