X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftilegx-tdep.c;h=4e46d098c735e3d4a6fa9fd82caac47ac6dd46ac;hb=40dba2056227af4b1d9855b40adc5fb32505b0a5;hp=fd42a350473193d4991f7e01f72ea47261db5d31;hpb=61baf725eca99af2569262d10aca03dcde2698f6;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index fd42a35047..4e46d098c7 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for the Tilera TILE-Gx processor. - Copyright (C) 2012-2017 Free Software Foundation, Inc. + Copyright (C) 2012-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -21,7 +21,7 @@ #include "frame.h" #include "frame-base.h" #include "frame-unwind.h" -#include "dwarf2-frame.h" +#include "dwarf2/frame.h" #include "trad-frame.h" #include "symtab.h" #include "gdbtypes.h" @@ -31,10 +31,8 @@ #include "dis-asm.h" #include "inferior.h" #include "arch-utils.h" -#include "floatformat.h" #include "regcache.h" #include "regset.h" -#include "doublest.h" #include "osabi.h" #include "linux-tdep.h" #include "objfiles.h" @@ -42,6 +40,7 @@ #include "tilegx-tdep.h" #include "opcode/tilegx.h" #include +#include "gdbsupport/byte-vector.h" struct tilegx_frame_cache { @@ -189,9 +188,9 @@ tilegx_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num) static int tilegx_type_is_scalar (struct type *t) { - return (TYPE_CODE(t) != TYPE_CODE_STRUCT - && TYPE_CODE(t) != TYPE_CODE_UNION - && TYPE_CODE(t) != TYPE_CODE_ARRAY); + return (t->code () != TYPE_CODE_STRUCT + && t->code () != TYPE_CODE_UNION + && t->code () != TYPE_CODE_ARRAY); } /* Returns non-zero if the given struct type will be returned using @@ -220,7 +219,7 @@ tilegx_extract_return_value (struct type *type, struct regcache *regcache, int i, regnum = TILEGX_R0_REGNUM; for (i = 0; i < len; i += tilegx_reg_size) - regcache_raw_read (regcache, regnum++, valbuf + i); + regcache->raw_read (regnum++, valbuf + i); } /* Copy the function return value from VALBUF into the proper @@ -237,7 +236,7 @@ tilegx_store_return_value (struct type *type, struct regcache *regcache, gdb_byte buf[tilegx_reg_size] = { 0 }; memcpy (buf, valbuf, TYPE_LENGTH (type)); - regcache_raw_write (regcache, TILEGX_R0_REGNUM, buf); + regcache->raw_write (TILEGX_R0_REGNUM, buf); } else { @@ -245,7 +244,7 @@ tilegx_store_return_value (struct type *type, struct regcache *regcache, int i, regnum = TILEGX_R0_REGNUM; for (i = 0; i < len; i += tilegx_reg_size) - regcache_raw_write (regcache, regnum++, (gdb_byte *) valbuf + i); + regcache->raw_write (regnum++, (gdb_byte *) valbuf + i); } } @@ -282,7 +281,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, - CORE_ADDR sp, int struct_return, + CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -294,7 +293,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch, /* If struct_return is 1, then the struct return address will consume one argument-passing register. */ - if (struct_return) + if (return_method == return_method_struct) regcache_cooked_write_unsigned (regcache, argreg++, struct_addr); /* Arguments are passed in R0 - R9, and as soon as an argument @@ -328,21 +327,17 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch, the stack, word aligned. */ for (j = nargs - 1; j >= i; j--) { - gdb_byte *val; - struct cleanup *back_to; const gdb_byte *contents = value_contents (args[j]); typelen = TYPE_LENGTH (value_enclosing_type (args[j])); slacklen = align_up (typelen, 8) - typelen; - val = (gdb_byte *) xmalloc (typelen + slacklen); - back_to = make_cleanup (xfree, val); - memcpy (val, contents, typelen); - memset (val + typelen, 0, slacklen); + gdb::byte_vector val (typelen + slacklen); + memcpy (val.data (), contents, typelen); + memset (val.data () + typelen, 0, slacklen); /* Now write data to the stack. The stack grows downwards. */ stack_dest -= typelen + slacklen; - write_memory (stack_dest, val, typelen + slacklen); - do_cleanups (back_to); + write_memory (stack_dest, val.data (), typelen + slacklen); } /* Add 16 bytes for linkage space to the stack. */ @@ -935,29 +930,6 @@ static const struct frame_base tilegx_frame_base = { tilegx_frame_base_address }; -static CORE_ADDR -tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) -{ - return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM); -} - -static CORE_ADDR -tilegx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) -{ - return frame_unwind_register_unsigned (next_frame, TILEGX_PC_REGNUM); -} - -static struct frame_id -tilegx_unwind_dummy_id (struct gdbarch *gdbarch, - struct frame_info *this_frame) -{ - CORE_ADDR sp; - - sp = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM); - return frame_id_build (sp, get_frame_pc (this_frame)); -} - - /* We cannot read/write the "special" registers. */ static int @@ -1032,9 +1004,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Frame Info. */ - set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp); - set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc); - set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id); set_gdbarch_frame_align (gdbarch, tilegx_frame_align); frame_base_set_default (gdbarch, &tilegx_frame_base); @@ -1055,8 +1024,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tilegx_breakpoint::bp_from_kind); set_gdbarch_return_value (gdbarch, tilegx_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_tilegx); - gdbarch_init_osabi (info, gdbarch); dwarf2_append_unwinders (gdbarch); @@ -1065,11 +1032,9 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return gdbarch; } -/* Provide a prototype to silence -Wmissing-prototypes. */ -extern initialize_file_ftype _initialize_tilegx_tdep; - +void _initialize_tilegx_tdep (); void -_initialize_tilegx_tdep (void) +_initialize_tilegx_tdep () { register_gdbarch_init (bfd_arch_tilegx, tilegx_gdbarch_init); }