X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Farm-tdep.c;h=69c87c5a43252ba91e5c2b7b0f946fc08ddf6655;hb=ff8577f64987a898e1dc5eb6afb66a404fb7bb16;hp=0c1a0b3294ac39818fd1d95dbafda1acc1f4a398;hpb=e60eb2880368b4e4752577c626ab0dadf0499cb5;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 0c1a0b3294..69c87c5a43 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1,6 +1,6 @@ /* Common target dependent code for GDB on ARM systems. - Copyright (C) 1988-2017 Free Software Foundation, Inc. + Copyright (C) 1988-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -30,7 +30,7 @@ #include "disasm.h" #include "regcache.h" #include "reggroups.h" -#include "doublest.h" +#include "target-float.h" #include "value.h" #include "arch-utils.h" #include "osabi.h" @@ -44,7 +44,7 @@ #include "remote.h" #include "target-descriptions.h" #include "user-regs.h" -#include "observer.h" +#include "observable.h" #include "arch/arm.h" #include "arch/arm-get-next-pcs.h" @@ -55,25 +55,15 @@ #include "coff/internal.h" #include "elf/arm.h" -#include "vec.h" - #include "record.h" #include "record-full.h" #include -#include "features/arm/arm-with-m.c" -#include "features/arm/arm-with-m-fpa-layout.c" -#include "features/arm/arm-with-m-vfp-d16.c" -#include "features/arm/arm-with-iwmmxt.c" -#include "features/arm/arm-with-vfpv2.c" -#include "features/arm/arm-with-vfpv3.c" -#include "features/arm/arm-with-neon.c" - #if GDB_SELF_TEST -#include "selftest.h" +#include "gdbsupport/selftest.h" #endif -static int arm_debug; +static bool arm_debug; /* Macros for setting and testing a bit in a minimal symbol that marks it as Thumb function. The MSB of the minimal symbol's "info" field @@ -88,22 +78,44 @@ static int arm_debug; #define MSYMBOL_IS_SPECIAL(msym) \ MSYMBOL_TARGET_FLAG_1 (msym) -/* Per-objfile data used for mapping symbols. */ -static const struct objfile_data *arm_objfile_data_key; - struct arm_mapping_symbol { bfd_vma value; char type; + + bool operator< (const arm_mapping_symbol &other) const + { return this->value < other.value; } }; -typedef struct arm_mapping_symbol arm_mapping_symbol_s; -DEF_VEC_O(arm_mapping_symbol_s); -struct arm_per_objfile +typedef std::vector arm_mapping_symbol_vec; + +struct arm_per_bfd { - VEC(arm_mapping_symbol_s) **section_maps; + explicit arm_per_bfd (size_t num_sections) + : section_maps (new arm_mapping_symbol_vec[num_sections]), + section_maps_sorted (new bool[num_sections] ()) + {} + + DISABLE_COPY_AND_ASSIGN (arm_per_bfd); + + /* Information about mapping symbols ($a, $d, $t) in the objfile. + + The format is an array of vectors of arm_mapping_symbols, there is one + vector for each section of the objfile (the array is index by BFD section + index). + + For each section, the vector of arm_mapping_symbol is sorted by + symbol value (address). */ + std::unique_ptr section_maps; + + /* For each corresponding element of section_maps above, is this vector + sorted. */ + std::unique_ptr section_maps_sorted; }; +/* Per-bfd data used for mapping symbols. */ +static bfd_key arm_bfd_data_key; + /* The list of available "set arm ..." and "show arm ..." commands. */ static struct cmd_list_element *setarmcmdlist = NULL; static struct cmd_list_element *showarmcmdlist = NULL; @@ -218,21 +230,20 @@ static const char **valid_disassembly_styles; /* Disassembly style to use. Default to "std" register names. */ static const char *disassembly_style; +/* All possible arm target descriptors. */ +static struct target_desc *tdesc_arm_list[ARM_FP_TYPE_INVALID]; +static struct target_desc *tdesc_arm_mprofile_list[ARM_M_TYPE_INVALID]; + /* This is used to keep the bfd arch_info in sync with the disassembly style. */ -static void set_disassembly_style_sfunc(char *, int, +static void set_disassembly_style_sfunc (const char *, int, struct cmd_list_element *); static void show_disassembly_style_sfunc (struct ui_file *, int, struct cmd_list_element *, const char *); -static void convert_from_extended (const struct floatformat *, const void *, - void *, int); -static void convert_to_extended (const struct floatformat *, void *, - const void *, int); - static enum register_status arm_neon_quad_read (struct gdbarch *gdbarch, - struct regcache *regcache, + readable_regcache *regcache, int regnum, gdb_byte *buf); static void arm_neon_quad_write (struct gdbarch *gdbarch, struct regcache *regcache, @@ -281,9 +292,9 @@ static CORE_ADDR arm_analyze_prologue (struct gdbarch *gdbarch, #define DISPLACED_STEPPING_ARCH_VERSION 5 -/* Set to true if the 32-bit mode is in use. */ +/* See arm-tdep.h. */ -int arm_apcs_32 = 1; +bool arm_apcs_32 = true; /* Return the bit mask in ARM_PS_REGNUM that indicates Thumb mode. */ @@ -302,7 +313,7 @@ int arm_is_thumb (struct regcache *regcache) { ULONGEST cpsr; - ULONGEST t_bit = arm_psr_thumb_bit (get_regcache_arch (regcache)); + ULONGEST t_bit = arm_psr_thumb_bit (regcache->arch ()); cpsr = regcache_raw_get_unsigned (regcache, ARM_PS_REGNUM); @@ -326,15 +337,6 @@ arm_frame_is_thumb (struct frame_info *frame) return (cpsr & t_bit) != 0; } -/* Callback for VEC_lower_bound. */ - -static inline int -arm_compare_mapping_symbols (const struct arm_mapping_symbol *lhs, - const struct arm_mapping_symbol *rhs) -{ - return lhs->value < rhs->value; -} - /* Search for the mapping symbol covering MEMADDR. If one is found, return its type. Otherwise, return 0. If START is non-NULL, set *START to the location of the mapping symbol. */ @@ -348,47 +350,48 @@ arm_find_mapping_symbol (CORE_ADDR memaddr, CORE_ADDR *start) sec = find_pc_section (memaddr); if (sec != NULL) { - struct arm_per_objfile *data; - VEC(arm_mapping_symbol_s) *map; - struct arm_mapping_symbol map_key = { memaddr - obj_section_addr (sec), - 0 }; - unsigned int idx; - - data = (struct arm_per_objfile *) objfile_data (sec->objfile, - arm_objfile_data_key); + arm_per_bfd *data = arm_bfd_data_key.get (sec->objfile->obfd); if (data != NULL) { - map = data->section_maps[sec->the_bfd_section->index]; - if (!VEC_empty (arm_mapping_symbol_s, map)) - { - struct arm_mapping_symbol *map_sym; + unsigned int section_idx = sec->the_bfd_section->index; + arm_mapping_symbol_vec &map + = data->section_maps[section_idx]; - idx = VEC_lower_bound (arm_mapping_symbol_s, map, &map_key, - arm_compare_mapping_symbols); + /* Sort the vector on first use. */ + if (!data->section_maps_sorted[section_idx]) + { + std::sort (map.begin (), map.end ()); + data->section_maps_sorted[section_idx] = true; + } - /* VEC_lower_bound finds the earliest ordered insertion - point. If the following symbol starts at this exact - address, we use that; otherwise, the preceding - mapping symbol covers this address. */ - if (idx < VEC_length (arm_mapping_symbol_s, map)) - { - map_sym = VEC_index (arm_mapping_symbol_s, map, idx); - if (map_sym->value == map_key.value) - { - if (start) - *start = map_sym->value + obj_section_addr (sec); - return map_sym->type; - } - } + struct arm_mapping_symbol map_key + = { memaddr - obj_section_addr (sec), 0 }; + arm_mapping_symbol_vec::const_iterator it + = std::lower_bound (map.begin (), map.end (), map_key); - if (idx > 0) + /* std::lower_bound finds the earliest ordered insertion + point. If the symbol at this position starts at this exact + address, we use that; otherwise, the preceding + mapping symbol covers this address. */ + if (it < map.end ()) + { + if (it->value == map_key.value) { - map_sym = VEC_index (arm_mapping_symbol_s, map, idx - 1); if (start) - *start = map_sym->value + obj_section_addr (sec); - return map_sym->type; + *start = it->value + obj_section_addr (sec); + return it->type; } } + + if (it > map.begin ()) + { + arm_mapping_symbol_vec::const_iterator prev_it + = it - 1; + + if (start) + *start = prev_it->value + obj_section_addr (sec); + return prev_it->type; + } } } @@ -404,8 +407,9 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr) { struct bound_minimal_symbol sym; char type; - struct displaced_step_closure* dsc - = get_displaced_step_closure_by_addr(memaddr); + arm_displaced_step_closure *dsc + = ((arm_displaced_step_closure * ) + get_displaced_step_closure_by_addr (memaddr)); /* If checking the mode of displaced instruction in copy area, the mode should be determined by instruction on the original address. */ @@ -546,9 +550,9 @@ skip_prologue_function (struct gdbarch *gdbarch, CORE_ADDR pc, int is_thumb) msym = lookup_minimal_symbol_by_pc (pc); if (msym.minsym != NULL && BMSYMBOL_VALUE_ADDRESS (msym) == pc - && MSYMBOL_LINKAGE_NAME (msym.minsym) != NULL) + && msym.minsym->linkage_name () != NULL) { - const char *name = MSYMBOL_LINKAGE_NAME (msym.minsym); + const char *name = msym.minsym->linkage_name (); /* The GNU linker's Thumb call stub to foo is named __foo_from_thumb. */ @@ -652,15 +656,12 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); int i; pv_t regs[16]; - struct pv_area *stack; - struct cleanup *back_to; CORE_ADDR offset; CORE_ADDR unrecognized_pc = 0; for (i = 0; i < 16; i++) regs[i] = pv_register (i, 0); - stack = make_pv_area (ARM_SP_REGNUM, gdbarch_addr_bit (gdbarch)); - back_to = make_cleanup_free_pv_area (stack); + pv_area stack (ARM_SP_REGNUM, gdbarch_addr_bit (gdbarch)); while (start < limit) { @@ -673,7 +674,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, int regno; int mask; - if (pv_area_store_would_trash (stack, regs[ARM_SP_REGNUM])) + if (stack.store_would_trash (regs[ARM_SP_REGNUM])) break; /* Bits 0-7 contain a mask for registers R0-R7. Bit 8 says @@ -686,7 +687,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, { regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -4); - pv_area_store (stack, regs[ARM_SP_REGNUM], 4, regs[regno]); + stack.store (regs[ARM_SP_REGNUM], 4, regs[regno]); } } else if ((insn & 0xff80) == 0xb080) /* sub sp, #imm */ @@ -740,10 +741,10 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, offset = (insn & 0xff) << 2; addr = pv_add_constant (regs[ARM_SP_REGNUM], offset); - if (pv_area_store_would_trash (stack, addr)) + if (stack.store_would_trash (addr)) break; - pv_area_store (stack, addr, 4, regs[regno]); + stack.store (addr, 4, regs[regno]); } else if ((insn & 0xf800) == 0x6000) /* str rd, [rn, #off] */ { @@ -754,10 +755,10 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, offset = bits (insn, 6, 10) << 2; addr = pv_add_constant (regs[rn], offset); - if (pv_area_store_would_trash (stack, addr)) + if (stack.store_would_trash (addr)) break; - pv_area_store (stack, addr, 4, regs[rd]); + stack.store (addr, 4, regs[rd]); } else if (((insn & 0xf800) == 0x7000 /* strb Rd, [Rn, #off] */ || (insn & 0xf800) == 0x8000) /* strh Rd, [Rn, #off] */ @@ -833,7 +834,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, pv_t addr = regs[bits (insn, 0, 3)]; int regno; - if (pv_area_store_would_trash (stack, addr)) + if (stack.store_would_trash (addr)) break; /* Calculate offsets of saved registers. */ @@ -841,7 +842,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, if (inst2 & (1 << regno)) { addr = pv_add_constant (addr, -4); - pv_area_store (stack, addr, 4, regs[regno]); + stack.store (addr, 4, regs[regno]); } if (insn & 0x0020) @@ -862,12 +863,12 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, else addr = pv_add_constant (addr, -offset); - if (pv_area_store_would_trash (stack, addr)) + if (stack.store_would_trash (addr)) break; - pv_area_store (stack, addr, 4, regs[regno1]); - pv_area_store (stack, pv_add_constant (addr, 4), - 4, regs[regno2]); + stack.store (addr, 4, regs[regno1]); + stack.store (pv_add_constant (addr, 4), + 4, regs[regno2]); if (insn & 0x0020) regs[bits (insn, 0, 3)] = addr; @@ -886,10 +887,10 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, else addr = pv_add_constant (addr, -offset); - if (pv_area_store_would_trash (stack, addr)) + if (stack.store_would_trash (addr)) break; - pv_area_store (stack, addr, 4, regs[regno]); + stack.store (addr, 4, regs[regno]); if (inst2 & 0x0100) regs[bits (insn, 0, 3)] = addr; @@ -904,10 +905,10 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, offset = inst2 & 0xfff; addr = pv_add_constant (regs[bits (insn, 0, 3)], offset); - if (pv_area_store_would_trash (stack, addr)) + if (stack.store_would_trash (addr)) break; - pv_area_store (stack, addr, 4, regs[regno]); + stack.store (addr, 4, regs[regno]); } else if ((insn & 0xffd0) == 0xf880 /* str{bh}.w Rt,[Rn,#imm] */ @@ -1090,10 +1091,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, unrecognized_pc = start; if (cache == NULL) - { - do_cleanups (back_to); - return unrecognized_pc; - } + return unrecognized_pc; if (pv_is_register (regs[ARM_FP_REGNUM], ARM_SP_REGNUM)) { @@ -1115,10 +1113,9 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, } for (i = 0; i < 16; i++) - if (pv_area_find_reg (stack, gdbarch, i, &offset)) + if (stack.find_reg (gdbarch, i, &offset)) cache->saved_regs[i].addr = offset; - do_cleanups (back_to); return unrecognized_pc; } @@ -1257,7 +1254,7 @@ arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch) /* ADDR must correspond to a symbol whose name is __stack_chk_guard. Otherwise, this sequence cannot be for stack protector. */ if (stack_chk_guard.minsym == NULL - || !startswith (MSYMBOL_LINKAGE_NAME (stack_chk_guard.minsym), "__stack_chk_guard")) + || !startswith (stack_chk_guard.minsym->linkage_name (), "__stack_chk_guard")) return pc; if (is_thumb) @@ -1494,8 +1491,6 @@ arm_analyze_prologue (struct gdbarch *gdbarch, int regno; CORE_ADDR offset, current_pc; pv_t regs[ARM_FPS_REGNUM]; - struct pv_area *stack; - struct cleanup *back_to; CORE_ADDR unrecognized_pc = 0; /* Search the prologue looking for instructions that set up the @@ -1510,8 +1505,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch, for (regno = 0; regno < ARM_FPS_REGNUM; regno++) regs[regno] = pv_register (regno, 0); - stack = make_pv_area (ARM_SP_REGNUM, gdbarch_addr_bit (gdbarch)); - back_to = make_cleanup_free_pv_area (stack); + pv_area stack (ARM_SP_REGNUM, gdbarch_addr_bit (gdbarch)); for (current_pc = prologue_start; current_pc < prologue_end; @@ -1548,11 +1542,11 @@ arm_analyze_prologue (struct gdbarch *gdbarch, else if ((insn & 0xffff0fff) == 0xe52d0004) /* str Rd, [sp, #-4]! */ { - if (pv_area_store_would_trash (stack, regs[ARM_SP_REGNUM])) + if (stack.store_would_trash (regs[ARM_SP_REGNUM])) break; regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -4); - pv_area_store (stack, regs[ARM_SP_REGNUM], 4, - regs[bits (insn, 12, 15)]); + stack.store (regs[ARM_SP_REGNUM], 4, + regs[bits (insn, 12, 15)]); continue; } else if ((insn & 0xffff0000) == 0xe92d0000) @@ -1562,7 +1556,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch, { int mask = insn & 0xffff; - if (pv_area_store_would_trash (stack, regs[ARM_SP_REGNUM])) + if (stack.store_would_trash (regs[ARM_SP_REGNUM])) break; /* Calculate offsets of saved registers. */ @@ -1571,7 +1565,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch, { regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -4); - pv_area_store (stack, regs[ARM_SP_REGNUM], 4, regs[regno]); + stack.store (regs[ARM_SP_REGNUM], 4, regs[regno]); } } else if ((insn & 0xffff0000) == 0xe54b0000 /* strb rx,[r11,#-n] */ @@ -1613,12 +1607,12 @@ arm_analyze_prologue (struct gdbarch *gdbarch, [sp, -#c]! */ && gdbarch_tdep (gdbarch)->have_fpa_registers) { - if (pv_area_store_would_trash (stack, regs[ARM_SP_REGNUM])) + if (stack.store_would_trash (regs[ARM_SP_REGNUM])) break; regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -12); regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07); - pv_area_store (stack, regs[ARM_SP_REGNUM], 12, regs[regno]); + stack.store (regs[ARM_SP_REGNUM], 12, regs[regno]); } else if ((insn & 0xffbf0fff) == 0xec2d0200 /* sfmfd f0, 4, [sp!] */ @@ -1627,7 +1621,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch, int n_saved_fp_regs; unsigned int fp_start_reg, fp_bound_reg; - if (pv_area_store_would_trash (stack, regs[ARM_SP_REGNUM])) + if (stack.store_would_trash (regs[ARM_SP_REGNUM])) break; if ((insn & 0x800) == 0x800) /* N0 is set */ @@ -1650,8 +1644,8 @@ arm_analyze_prologue (struct gdbarch *gdbarch, for (; fp_start_reg < fp_bound_reg; fp_start_reg++) { regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -12); - pv_area_store (stack, regs[ARM_SP_REGNUM], 12, - regs[fp_start_reg++]); + stack.store (regs[ARM_SP_REGNUM], 12, + regs[fp_start_reg++]); } } else if ((insn & 0xff000000) == 0xeb000000 && cache == NULL) /* bl */ @@ -1731,7 +1725,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch, cache->framesize = framesize; for (regno = 0; regno < ARM_FPS_REGNUM; regno++) - if (pv_area_find_reg (stack, gdbarch, regno, &offset)) + if (stack.find_reg (gdbarch, regno, &offset)) cache->saved_regs[regno].addr = offset; } @@ -1739,7 +1733,6 @@ arm_analyze_prologue (struct gdbarch *gdbarch, fprintf_unfiltered (gdb_stdlog, "Prologue scan stopped at %s\n", paddress (gdbarch, unrecognized_pc)); - do_cleanups (back_to); return unrecognized_pc; } @@ -1816,6 +1809,10 @@ arm_scan_prologue (struct frame_info *this_frame, CORE_ADDR frame_loc; ULONGEST return_value; + /* AAPCS does not use a frame register, so we can abort here. */ + if (gdbarch_tdep (gdbarch)->arm_abi == ARM_ABI_AAPCS) + return; + frame_loc = get_frame_register_unsigned (this_frame, ARM_FP_REGNUM); if (!safe_read_memory_unsigned_integer (frame_loc, 4, byte_order, &return_value)) @@ -1986,37 +1983,24 @@ struct frame_unwind arm_prologue_unwind = { personality routines; the cache will contain only the frame unwinding instructions associated with the entry (not the descriptors). */ -static const struct objfile_data *arm_exidx_data_key; - struct arm_exidx_entry { bfd_vma addr; gdb_byte *entry; + + bool operator< (const arm_exidx_entry &other) const + { + return addr < other.addr; + } }; -typedef struct arm_exidx_entry arm_exidx_entry_s; -DEF_VEC_O(arm_exidx_entry_s); struct arm_exidx_data { - VEC(arm_exidx_entry_s) **section_maps; + std::vector> section_maps; }; -static void -arm_exidx_data_free (struct objfile *objfile, void *arg) -{ - struct arm_exidx_data *data = (struct arm_exidx_data *) arg; - unsigned int i; - - for (i = 0; i < objfile->obfd->section_count; i++) - VEC_free (arm_exidx_entry_s, data->section_maps[i]); -} - -static inline int -arm_compare_exidx_entries (const struct arm_exidx_entry *lhs, - const struct arm_exidx_entry *rhs) -{ - return lhs->addr < rhs->addr; -} +/* Per-BFD key to store exception handling information. */ +static const struct bfd_key arm_exidx_data_key; static struct obj_section * arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma) @@ -2024,12 +2008,11 @@ arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma) struct obj_section *osect; ALL_OBJFILE_OSECTIONS (objfile, osect) - if (bfd_get_section_flags (objfile->obfd, - osect->the_bfd_section) & SEC_ALLOC) + if (bfd_section_flags (osect->the_bfd_section) & SEC_ALLOC) { bfd_vma start, size; - start = bfd_get_section_vma (objfile->obfd, osect->the_bfd_section); - size = bfd_get_section_size (osect->the_bfd_section); + start = bfd_section_vma (osect->the_bfd_section); + size = bfd_section_size (osect->the_bfd_section); if (start <= vma && vma < start + size) return osect; @@ -2055,65 +2038,53 @@ arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma) static void arm_exidx_new_objfile (struct objfile *objfile) { - struct cleanup *cleanups; struct arm_exidx_data *data; asection *exidx, *extab; bfd_vma exidx_vma = 0, extab_vma = 0; - bfd_size_type exidx_size = 0, extab_size = 0; - gdb_byte *exidx_data = NULL, *extab_data = NULL; LONGEST i; /* If we've already touched this file, do nothing. */ - if (!objfile || objfile_data (objfile, arm_exidx_data_key) != NULL) + if (!objfile || arm_exidx_data_key.get (objfile->obfd) != NULL) return; - cleanups = make_cleanup (null_cleanup, NULL); /* Read contents of exception table and index. */ exidx = bfd_get_section_by_name (objfile->obfd, ELF_STRING_ARM_unwind); + gdb::byte_vector exidx_data; if (exidx) { - exidx_vma = bfd_section_vma (objfile->obfd, exidx); - exidx_size = bfd_get_section_size (exidx); - exidx_data = (gdb_byte *) xmalloc (exidx_size); - make_cleanup (xfree, exidx_data); + exidx_vma = bfd_section_vma (exidx); + exidx_data.resize (bfd_section_size (exidx)); if (!bfd_get_section_contents (objfile->obfd, exidx, - exidx_data, 0, exidx_size)) - { - do_cleanups (cleanups); - return; - } + exidx_data.data (), 0, + exidx_data.size ())) + return; } extab = bfd_get_section_by_name (objfile->obfd, ".ARM.extab"); + gdb::byte_vector extab_data; if (extab) { - extab_vma = bfd_section_vma (objfile->obfd, extab); - extab_size = bfd_get_section_size (extab); - extab_data = (gdb_byte *) xmalloc (extab_size); - make_cleanup (xfree, extab_data); + extab_vma = bfd_section_vma (extab); + extab_data.resize (bfd_section_size (extab)); if (!bfd_get_section_contents (objfile->obfd, extab, - extab_data, 0, extab_size)) - { - do_cleanups (cleanups); - return; - } + extab_data.data (), 0, + extab_data.size ())) + return; } /* Allocate exception table data structure. */ - data = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct arm_exidx_data); - set_objfile_data (objfile, arm_exidx_data_key, data); - data->section_maps = OBSTACK_CALLOC (&objfile->objfile_obstack, - objfile->obfd->section_count, - VEC(arm_exidx_entry_s) *); + data = arm_exidx_data_key.emplace (objfile->obfd); + data->section_maps.resize (objfile->obfd->section_count); /* Fill in exception table. */ - for (i = 0; i < exidx_size / 8; i++) + for (i = 0; i < exidx_data.size () / 8; i++) { struct arm_exidx_entry new_exidx_entry; - bfd_vma idx = bfd_h_get_32 (objfile->obfd, exidx_data + i * 8); - bfd_vma val = bfd_h_get_32 (objfile->obfd, exidx_data + i * 8 + 4); + bfd_vma idx = bfd_h_get_32 (objfile->obfd, exidx_data.data () + i * 8); + bfd_vma val = bfd_h_get_32 (objfile->obfd, + exidx_data.data () + i * 8 + 4); bfd_vma addr = 0, word = 0; int n_bytes = 0, n_words = 0; struct obj_section *sec; @@ -2127,7 +2098,7 @@ arm_exidx_new_objfile (struct objfile *objfile) sec = arm_obj_section_from_vma (objfile, idx); if (sec == NULL) continue; - idx -= bfd_get_section_vma (objfile->obfd, sec->the_bfd_section); + idx -= bfd_section_vma (sec->the_bfd_section); /* Determine address of exception table entry. */ if (val == 1) @@ -2147,10 +2118,10 @@ arm_exidx_new_objfile (struct objfile *objfile) addr = ((val & 0x7fffffff) ^ 0x40000000) - 0x40000000; addr += exidx_vma + i * 8 + 4; - if (addr >= extab_vma && addr + 4 <= extab_vma + extab_size) + if (addr >= extab_vma && addr + 4 <= extab_vma + extab_data.size ()) { word = bfd_h_get_32 (objfile->obfd, - extab_data + addr - extab_vma); + extab_data.data () + addr - extab_vma); addr += 4; if ((word & 0xff000000) == 0x80000000) @@ -2205,10 +2176,11 @@ arm_exidx_new_objfile (struct objfile *objfile) byte, followed by the same unwind instructions as the pre-defined forms. */ if (gnu_personality - && addr + 4 <= extab_vma + extab_size) + && addr + 4 <= extab_vma + extab_data.size ()) { word = bfd_h_get_32 (objfile->obfd, - extab_data + addr - extab_vma); + (extab_data.data () + + addr - extab_vma)); addr += 4; n_bytes = 3; n_words = ((word >> 24) & 0xff); @@ -2219,7 +2191,8 @@ arm_exidx_new_objfile (struct objfile *objfile) /* Sanity check address. */ if (n_words) - if (addr < extab_vma || addr + 4 * n_words > extab_vma + extab_size) + if (addr < extab_vma + || addr + 4 * n_words > extab_vma + extab_data.size ()) n_words = n_bytes = 0; /* The unwind instructions reside in WORD (only the N_BYTES least @@ -2237,7 +2210,7 @@ arm_exidx_new_objfile (struct objfile *objfile) while (n_words--) { word = bfd_h_get_32 (objfile->obfd, - extab_data + addr - extab_vma); + extab_data.data () + addr - extab_vma); addr += 4; *p++ = (gdb_byte) ((word >> 24) & 0xff); @@ -2254,12 +2227,9 @@ arm_exidx_new_objfile (struct objfile *objfile) appear in order of increasing addresses. */ new_exidx_entry.addr = idx; new_exidx_entry.entry = entry; - VEC_safe_push (arm_exidx_entry_s, - data->section_maps[sec->the_bfd_section->index], - &new_exidx_entry); + data->section_maps[sec->the_bfd_section->index].push_back + (new_exidx_entry); } - - do_cleanups (cleanups); } /* Search for the exception table entry covering MEMADDR. If one is found, @@ -2275,43 +2245,37 @@ arm_find_exidx_entry (CORE_ADDR memaddr, CORE_ADDR *start) if (sec != NULL) { struct arm_exidx_data *data; - VEC(arm_exidx_entry_s) *map; struct arm_exidx_entry map_key = { memaddr - obj_section_addr (sec), 0 }; - unsigned int idx; - data = ((struct arm_exidx_data *) - objfile_data (sec->objfile, arm_exidx_data_key)); + data = arm_exidx_data_key.get (sec->objfile->obfd); if (data != NULL) { - map = data->section_maps[sec->the_bfd_section->index]; - if (!VEC_empty (arm_exidx_entry_s, map)) + std::vector &map + = data->section_maps[sec->the_bfd_section->index]; + if (!map.empty ()) { - struct arm_exidx_entry *map_sym; + auto idx = std::lower_bound (map.begin (), map.end (), map_key); - idx = VEC_lower_bound (arm_exidx_entry_s, map, &map_key, - arm_compare_exidx_entries); - - /* VEC_lower_bound finds the earliest ordered insertion + /* std::lower_bound finds the earliest ordered insertion point. If the following symbol starts at this exact address, we use that; otherwise, the preceding exception table entry covers this address. */ - if (idx < VEC_length (arm_exidx_entry_s, map)) + if (idx < map.end ()) { - map_sym = VEC_index (arm_exidx_entry_s, map, idx); - if (map_sym->addr == map_key.addr) + if (idx->addr == map_key.addr) { if (start) - *start = map_sym->addr + obj_section_addr (sec); - return map_sym->entry; + *start = idx->addr + obj_section_addr (sec); + return idx->entry; } } - if (idx > 0) + if (idx > map.begin ()) { - map_sym = VEC_index (arm_exidx_entry_s, map, idx - 1); + idx = idx - 1; if (start) - *start = map_sym->addr + obj_section_addr (sec); - return map_sym->entry; + *start = idx->addr + obj_section_addr (sec); + return idx->entry; } } } @@ -3079,38 +3043,6 @@ struct frame_base arm_normal_base = { arm_normal_frame_base }; -/* Assuming THIS_FRAME is a dummy, return the frame ID of that - dummy frame. The frame ID's base needs to match the TOS value - saved by save_dummy_frame_tos() and returned from - arm_push_dummy_call, and the PC needs to match the dummy frame's - breakpoint. */ - -static struct frame_id -arm_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - return frame_id_build (get_frame_register_unsigned (this_frame, - ARM_SP_REGNUM), - get_frame_pc (this_frame)); -} - -/* Given THIS_FRAME, find the previous frame's resume PC (which will - be used to construct the previous frame's ID, after looking up the - containing function). */ - -static CORE_ADDR -arm_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - CORE_ADDR pc; - pc = frame_unwind_register_unsigned (this_frame, ARM_PC_REGNUM); - return arm_addr_bits_remove (gdbarch, pc); -} - -static CORE_ADDR -arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - return frame_unwind_register_unsigned (this_frame, ARM_SP_REGNUM); -} - static struct value * arm_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache, int regnum) @@ -3366,62 +3298,25 @@ pop_stack_item (struct stack_item *si) return si; } +/* Implement the gdbarch type alignment method, overrides the generic + alignment algorithm for anything that is arm specific. */ -/* Return the alignment (in bytes) of the given type. */ - -static int -arm_type_align (struct type *t) +static ULONGEST +arm_type_align (gdbarch *gdbarch, struct type *t) { - int n; - int align; - int falign; - t = check_typedef (t); - switch (TYPE_CODE (t)) + if (TYPE_CODE (t) == TYPE_CODE_ARRAY && TYPE_VECTOR (t)) { - default: - /* Should never happen. */ - internal_error (__FILE__, __LINE__, _("unknown type alignment")); - return 4; - - case TYPE_CODE_PTR: - case TYPE_CODE_ENUM: - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - case TYPE_CODE_SET: - case TYPE_CODE_RANGE: - case TYPE_CODE_REF: - case TYPE_CODE_RVALUE_REF: - case TYPE_CODE_CHAR: - case TYPE_CODE_BOOL: - return TYPE_LENGTH (t); - - case TYPE_CODE_ARRAY: - if (TYPE_VECTOR (t)) - { - /* Use the natural alignment for vector types (the same for - scalar type), but the maximum alignment is 64-bit. */ - if (TYPE_LENGTH (t) > 8) - return 8; - else - return TYPE_LENGTH (t); - } + /* Use the natural alignment for vector types (the same for + scalar type), but the maximum alignment is 64-bit. */ + if (TYPE_LENGTH (t) > 8) + return 8; else - return arm_type_align (TYPE_TARGET_TYPE (t)); - case TYPE_CODE_COMPLEX: - return arm_type_align (TYPE_TARGET_TYPE (t)); - - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - align = 1; - for (n = 0; n < TYPE_NFIELDS (t); n++) - { - falign = arm_type_align (TYPE_FIELD_TYPE (t, n)); - if (falign > align) - align = falign; - } - return align; + return TYPE_LENGTH (t); } + + /* Allow the common code to calculate the alignment. */ + return 0; } /* Possible base types for a candidate for passing and returning in @@ -3703,7 +3598,8 @@ arm_vfp_abi_for_function (struct gdbarch *gdbarch, struct type *func_type) static CORE_ADDR arm_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, + struct value **args, CORE_ADDR sp, + function_call_return_method return_method, CORE_ADDR struct_addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -3738,7 +3634,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* The struct_return pointer occupies the first parameter passing register. */ - if (struct_return) + if (return_method == return_method_struct) { if (arm_debug) fprintf_unfiltered (gdb_stdlog, "struct return in %s = %s\n", @@ -3766,20 +3662,21 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, typecode = TYPE_CODE (arg_type); val = value_contents (args[argnum]); - align = arm_type_align (arg_type); + align = type_align (arg_type); /* Round alignment up to a whole number of words. */ - align = (align + INT_REGISTER_SIZE - 1) & ~(INT_REGISTER_SIZE - 1); + align = (align + ARM_INT_REGISTER_SIZE - 1) + & ~(ARM_INT_REGISTER_SIZE - 1); /* Different ABIs have different maximum alignments. */ if (gdbarch_tdep (gdbarch)->arm_abi == ARM_ABI_APCS) { /* The APCS ABI only requires word alignment. */ - align = INT_REGISTER_SIZE; + align = ARM_INT_REGISTER_SIZE; } else { /* The AAPCS requires at most doubleword alignment. */ - if (align > INT_REGISTER_SIZE * 2) - align = INT_REGISTER_SIZE * 2; + if (align > ARM_INT_REGISTER_SIZE * 2) + align = ARM_INT_REGISTER_SIZE * 2; } if (use_vfp_abi @@ -3828,8 +3725,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, reg_char, reg_scaled + i); regnum = user_reg_map_name_to_regnum (gdbarch, name_buf, strlen (name_buf)); - regcache_cooked_write (regcache, regnum, - val + i * unit_length); + regcache->cooked_write (regnum, val + i * unit_length); } } continue; @@ -3842,17 +3738,17 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } } - /* Push stack padding for dowubleword alignment. */ + /* Push stack padding for doubleword alignment. */ if (nstack & (align - 1)) { - si = push_stack_item (si, val, INT_REGISTER_SIZE); - nstack += INT_REGISTER_SIZE; + si = push_stack_item (si, val, ARM_INT_REGISTER_SIZE); + nstack += ARM_INT_REGISTER_SIZE; } /* Doubleword aligned quantities must go in even register pairs. */ if (may_use_core_reg && argreg <= ARM_LAST_ARG_REGNUM - && align > INT_REGISTER_SIZE + && align > ARM_INT_REGISTER_SIZE && argreg & 1) argreg++; @@ -3878,7 +3774,8 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, registers and stack. */ while (len > 0) { - int partial_len = len < INT_REGISTER_SIZE ? len : INT_REGISTER_SIZE; + int partial_len = len < ARM_INT_REGISTER_SIZE + ? len : ARM_INT_REGISTER_SIZE; CORE_ADDR regval = extract_unsigned_integer (val, partial_len, byte_order); @@ -3887,19 +3784,19 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* The argument is being passed in a general purpose register. */ if (byte_order == BFD_ENDIAN_BIG) - regval <<= (INT_REGISTER_SIZE - partial_len) * 8; + regval <<= (ARM_INT_REGISTER_SIZE - partial_len) * 8; if (arm_debug) fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n", argnum, gdbarch_register_name (gdbarch, argreg), - phex (regval, INT_REGISTER_SIZE)); + phex (regval, ARM_INT_REGISTER_SIZE)); regcache_cooked_write_unsigned (regcache, argreg, regval); argreg++; } else { - gdb_byte buf[INT_REGISTER_SIZE]; + gdb_byte buf[ARM_INT_REGISTER_SIZE]; memset (buf, 0, sizeof (buf)); store_unsigned_integer (buf, partial_len, byte_order, regval); @@ -3908,8 +3805,8 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (arm_debug) fprintf_unfiltered (gdb_stdlog, "arg %d @ sp + %d\n", argnum, nstack); - si = push_stack_item (si, buf, INT_REGISTER_SIZE); - nstack += INT_REGISTER_SIZE; + si = push_stack_item (si, buf, ARM_INT_REGISTER_SIZE); + nstack += ARM_INT_REGISTER_SIZE; } len -= partial_len; @@ -4211,39 +4108,6 @@ arm_register_sim_regno (struct gdbarch *gdbarch, int regnum) internal_error (__FILE__, __LINE__, _("Bad REGNUM %d"), regnum); } -/* NOTE: cagney/2001-08-20: Both convert_from_extended() and - convert_to_extended() use floatformat_arm_ext_littlebyte_bigword. - It is thought that this is is the floating-point register format on - little-endian systems. */ - -static void -convert_from_extended (const struct floatformat *fmt, const void *ptr, - void *dbl, int endianess) -{ - DOUBLEST d; - - if (endianess == BFD_ENDIAN_BIG) - floatformat_to_doublest (&floatformat_arm_ext_big, ptr, &d); - else - floatformat_to_doublest (&floatformat_arm_ext_littlebyte_bigword, - ptr, &d); - floatformat_from_doublest (fmt, &d, dbl); -} - -static void -convert_to_extended (const struct floatformat *fmt, void *dbl, const void *ptr, - int endianess) -{ - DOUBLEST d; - - floatformat_to_doublest (fmt, ptr, &d); - if (endianess == BFD_ENDIAN_BIG) - floatformat_from_doublest (&floatformat_arm_ext_big, &d, dbl); - else - floatformat_from_doublest (&floatformat_arm_ext_littlebyte_bigword, - &d, dbl); -} - /* Given BUF, which is OLD_LEN bytes ending at ENDADDR, expand the buffer to be NEW_LEN bytes ending at ENDADDR. Return NULL if an error occurs. BUF is freed. */ @@ -4462,7 +4326,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr) location. */ ULONGEST -displaced_read_reg (struct regcache *regs, struct displaced_step_closure *dsc, +displaced_read_reg (struct regcache *regs, arm_displaced_step_closure *dsc, int regno) { ULONGEST ret; @@ -4500,7 +4364,7 @@ static int displaced_in_arm_mode (struct regcache *regs) { ULONGEST ps; - ULONGEST t_bit = arm_psr_thumb_bit (get_regcache_arch (regs)); + ULONGEST t_bit = arm_psr_thumb_bit (regs->arch ()); regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &ps); @@ -4510,7 +4374,7 @@ displaced_in_arm_mode (struct regcache *regs) /* Write to the PC as from a branch instruction. */ static void -branch_write_pc (struct regcache *regs, struct displaced_step_closure *dsc, +branch_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc, ULONGEST val) { if (!dsc->is_thumb) @@ -4529,7 +4393,7 @@ static void bx_write_pc (struct regcache *regs, ULONGEST val) { ULONGEST ps; - ULONGEST t_bit = arm_psr_thumb_bit (get_regcache_arch (regs)); + ULONGEST t_bit = arm_psr_thumb_bit (regs->arch ()); regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &ps); @@ -4556,7 +4420,7 @@ bx_write_pc (struct regcache *regs, ULONGEST val) /* Write to the PC as if from a load instruction. */ static void -load_write_pc (struct regcache *regs, struct displaced_step_closure *dsc, +load_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc, ULONGEST val) { if (DISPLACED_STEPPING_ARCH_VERSION >= 5) @@ -4568,7 +4432,7 @@ load_write_pc (struct regcache *regs, struct displaced_step_closure *dsc, /* Write to the PC as if from an ALU instruction. */ static void -alu_write_pc (struct regcache *regs, struct displaced_step_closure *dsc, +alu_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc, ULONGEST val) { if (DISPLACED_STEPPING_ARCH_VERSION >= 7 && !dsc->is_thumb) @@ -4582,7 +4446,7 @@ alu_write_pc (struct regcache *regs, struct displaced_step_closure *dsc, this is controlled by the WRITE_PC argument. */ void -displaced_write_reg (struct regcache *regs, struct displaced_step_closure *dsc, +displaced_write_reg (struct regcache *regs, arm_displaced_step_closure *dsc, int regno, ULONGEST val, enum pc_write_style write_pc) { if (regno == ARM_PC_REGNUM) @@ -4666,7 +4530,7 @@ insn_references_pc (uint32_t insn, uint32_t bitmask) static int arm_copy_unmodified (struct gdbarch *gdbarch, uint32_t insn, - const char *iname, struct displaced_step_closure *dsc) + const char *iname, arm_displaced_step_closure *dsc) { if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.8lx, " @@ -4681,7 +4545,7 @@ arm_copy_unmodified (struct gdbarch *gdbarch, uint32_t insn, static int thumb_copy_unmodified_32bit (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2, const char *iname, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.4x %.4x, " @@ -4700,7 +4564,7 @@ thumb_copy_unmodified_32bit (struct gdbarch *gdbarch, uint16_t insn1, static int thumb_copy_unmodified_16bit (struct gdbarch *gdbarch, uint16_t insn, const char *iname, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.4x, " @@ -4716,7 +4580,7 @@ thumb_copy_unmodified_16bit (struct gdbarch *gdbarch, uint16_t insn, static void cleanup_preload (struct gdbarch *gdbarch, - struct regcache *regs, struct displaced_step_closure *dsc) + struct regcache *regs, arm_displaced_step_closure *dsc) { displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC); if (!dsc->u.preload.immed) @@ -4725,7 +4589,7 @@ cleanup_preload (struct gdbarch *gdbarch, static void install_preload (struct gdbarch *gdbarch, struct regcache *regs, - struct displaced_step_closure *dsc, unsigned int rn) + arm_displaced_step_closure *dsc, unsigned int rn) { ULONGEST rn_val; /* Preload instructions: @@ -4744,7 +4608,7 @@ install_preload (struct gdbarch *gdbarch, struct regcache *regs, static int arm_copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { unsigned int rn = bits (insn, 16, 19); @@ -4764,7 +4628,7 @@ arm_copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, static int thumb2_copy_preload (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2, - struct regcache *regs, struct displaced_step_closure *dsc) + struct regcache *regs, arm_displaced_step_closure *dsc) { unsigned int rn = bits (insn1, 0, 3); unsigned int u_bit = bit (insn1, 7); @@ -4814,7 +4678,7 @@ thumb2_copy_preload (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2, static void install_preload_reg(struct gdbarch *gdbarch, struct regcache *regs, - struct displaced_step_closure *dsc, unsigned int rn, + arm_displaced_step_closure *dsc, unsigned int rn, unsigned int rm) { ULONGEST rn_val, rm_val; @@ -4839,7 +4703,7 @@ install_preload_reg(struct gdbarch *gdbarch, struct regcache *regs, static int arm_copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { unsigned int rn = bits (insn, 16, 19); unsigned int rm = bits (insn, 0, 3); @@ -4863,7 +4727,7 @@ arm_copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn, static void cleanup_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { ULONGEST rn_val = displaced_read_reg (regs, dsc, 0); @@ -4875,7 +4739,7 @@ cleanup_copro_load_store (struct gdbarch *gdbarch, static void install_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs, - struct displaced_step_closure *dsc, + arm_displaced_step_closure *dsc, int writeback, unsigned int rn) { ULONGEST rn_val; @@ -4903,7 +4767,7 @@ install_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs, static int arm_copy_copro_load_store (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { unsigned int rn = bits (insn, 16, 19); @@ -4924,7 +4788,7 @@ arm_copy_copro_load_store (struct gdbarch *gdbarch, uint32_t insn, static int thumb2_copy_copro_load_store (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2, struct regcache *regs, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { unsigned int rn = bits (insn1, 0, 3); @@ -4952,7 +4816,7 @@ thumb2_copy_copro_load_store (struct gdbarch *gdbarch, uint16_t insn1, static void cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs, - struct displaced_step_closure *dsc) + arm_displaced_step_closure *dsc) { uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM); int branch_taken = condition_true (dsc->u.branch.cond, status); @@ -4965,7 +4829,7 @@ cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs, if (dsc->u.branch.link) { /* The value of LR should be the next insn of current one. In order - not to confuse logic hanlding later insn `bx lr', if current insn mode + not to confuse logic handling later insn `bx lr', if current insn mode is Thumb, the bit 0 of LR value should be set to 1. */ ULONGEST next_insn_addr = dsc->insn_addr + dsc->insn_size; @@ -4983,7 +4847,7 @@ cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs, static void install_b_bl_blx (struct gdbarch *gdbarch, struct regcache *regs, - struct displaced_step_closure *dsc, + arm_displaced_step_closure *dsc, unsigned int cond, int exchange, int link, long offset) { /* Implement "BL