X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fmn10300-tdep.c;h=5d960347d21c9a41fdc810fdab5a320ab689ec65;hb=348fe36b1d64f12c60e08f6313520b3191663063;hp=25d73c015602ad343f74c3cca65d84b751207138;hpb=cf84fa6bcf514157df8343d32885050bafc396f7;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 25d73c0156..5d960347d2 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -28,7 +28,7 @@ #include "frame-unwind.h" #include "frame-base.h" #include "symtab.h" -#include "dwarf2-frame.h" +#include "dwarf2/frame.h" #include "osabi.h" #include "infcall.h" #include "prologue-value.h" @@ -88,7 +88,7 @@ mn10300_type_align (struct type *type) { int i, align = 1; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_INT: case TYPE_CODE_ENUM: @@ -107,9 +107,9 @@ mn10300_type_align (struct type *type) case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: - for (i = 0; i < TYPE_NFIELDS (type); i++) + for (i = 0; i < type->num_fields (); i++) { - int falign = mn10300_type_align (TYPE_FIELD_TYPE (type, i)); + int falign = mn10300_type_align (type->field (i).type ()); while (align < falign) align <<= 1; } @@ -117,7 +117,7 @@ mn10300_type_align (struct type *type) case TYPE_CODE_ARRAY: /* HACK! Structures containing arrays, even small ones, are not - elligible for returning in registers. */ + eligible for returning in registers. */ return 256; case TYPE_CODE_TYPEDEF: @@ -137,14 +137,14 @@ mn10300_use_struct_convention (struct type *type) if (TYPE_LENGTH (type) > 8) return 1; - switch (TYPE_CODE (type)) + switch (type->code ()) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: /* Structures with a single field are handled as the field itself. */ - if (TYPE_NFIELDS (type) == 1) - return mn10300_use_struct_convention (TYPE_FIELD_TYPE (type, 0)); + if (type->num_fields () == 1) + return mn10300_use_struct_convention (type->field (0).type ()); /* Structures with word or double-word size are passed in memory, as long as they require at least word alignment. */ @@ -174,7 +174,7 @@ mn10300_store_return_value (struct gdbarch *gdbarch, struct type *type, int len = TYPE_LENGTH (type); int reg, regsz; - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) reg = 4; else reg = 0; @@ -202,7 +202,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type, int len = TYPE_LENGTH (type); int reg, regsz; - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) reg = 4; else reg = 0; @@ -1098,15 +1098,6 @@ mn10300_frame_base (struct frame_info *this_frame, void **this_prologue_cache) } } -/* Here is a dummy implementation. */ -static struct frame_id -mn10300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM); - CORE_ADDR pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM); - return frame_id_build (sp, pc); -} - static void mn10300_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, @@ -1149,32 +1140,11 @@ static const struct frame_unwind mn10300_frame_unwind = { default_frame_sniffer }; -static CORE_ADDR -mn10300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - ULONGEST pc; - - pc = frame_unwind_register_unsigned (this_frame, E_PC_REGNUM); - return pc; -} - -static CORE_ADDR -mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - ULONGEST sp; - - sp = frame_unwind_register_unsigned (this_frame, E_SP_REGNUM); - return sp; -} - static void mn10300_frame_unwind_init (struct gdbarch *gdbarch) { dwarf2_append_unwinders (gdbarch); frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind); - set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id); - set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc); - set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp); } /* Function: push_dummy_call @@ -1238,7 +1208,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, for (argnum = 0; argnum < nargs; argnum++) { /* FIXME what about structs? Unions? */ - if (TYPE_CODE (value_type (*args)) == TYPE_CODE_STRUCT + if (value_type (*args)->code () == TYPE_CODE_STRUCT && TYPE_LENGTH (value_type (*args)) > 8) { /* Change to pointer-to-type. */ @@ -1308,7 +1278,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, { CORE_ADDR func_addr = find_function_addr (target_func, NULL); CORE_ADDR unwound_sp - = mn10300_unwind_sp (gdbarch, create_new_frame (sp, func_addr)); + = gdbarch_unwind_sp (gdbarch, create_new_frame (sp, func_addr)); if (sp != unwound_sp) regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, sp - (unwound_sp - sp)); @@ -1447,8 +1417,9 @@ mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file) tdep->am33_mode); } +void _initialize_mn10300_tdep (); void -_initialize_mn10300_tdep (void) +_initialize_mn10300_tdep () { gdbarch_register (bfd_arch_mn10300, mn10300_gdbarch_init, mn10300_dump_tdep); }