X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Farm-linux-tdep.c;h=9b69f8ad3d73805d8ee6b65ed4616c22539a889b;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=aec20877d9d2125fb03493494c416d1e405b8a6f;hpb=d105cce5dd8d6a5218b044fc161ce89c6b245432;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index aec20877d9..9b69f8ad3d 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -1,6 +1,6 @@ /* GNU/Linux on ARM target support. - Copyright (C) 1999-2019 Free Software Foundation, Inc. + Copyright (C) 1999-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -56,7 +56,6 @@ #include "user-regs.h" #include #include "elf/common.h" -extern int arm_apcs_32; /* Under ARM GNU/Linux the traditional way of performing a breakpoint is to execute a particular software interrupt, rather than use a @@ -947,7 +946,7 @@ arm_linux_software_single_step (struct regcache *regcache) static void arm_linux_cleanup_svc (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { ULONGEST apparent_pc; int within_scratch; @@ -975,7 +974,7 @@ arm_linux_cleanup_svc (struct gdbarch *gdbarch, static int arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { CORE_ADDR return_to = 0; @@ -1066,7 +1065,7 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs, static void cleanup_kernel_helper_return (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { displaced_write_reg (regs, dsc, ARM_LR_REGNUM, dsc->tmp[0], CANNOT_WRITE_PC); displaced_write_reg (regs, dsc, ARM_PC_REGNUM, dsc->tmp[0], BRANCH_WRITE_PC); @@ -1075,7 +1074,7 @@ cleanup_kernel_helper_return (struct gdbarch *gdbarch, static void arm_catch_kernel_helper_return (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -1104,12 +1103,13 @@ arm_catch_kernel_helper_return (struct gdbarch *gdbarch, CORE_ADDR from, the program has stepped into a Linux kernel helper routine (which must be handled as a special case). */ -static struct displaced_step_closure * +static displaced_step_copy_insn_closure_up arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { - arm_displaced_step_closure *dsc = new arm_displaced_step_closure; + std::unique_ptr dsc + (new arm_displaced_step_copy_insn_closure); /* Detect when we enter an (inaccessible by GDB) Linux kernel helper, and stop at the return location. */ @@ -1119,19 +1119,20 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, fprintf_unfiltered (gdb_stdlog, "displaced: detected kernel helper " "at %.8lx\n", (unsigned long) from); - arm_catch_kernel_helper_return (gdbarch, from, to, regs, dsc); + arm_catch_kernel_helper_return (gdbarch, from, to, regs, dsc.get ()); } else { /* Override the default handling of SVC instructions. */ dsc->u.svc.copy_svc_os = arm_linux_copy_svc; - arm_process_displaced_insn (gdbarch, from, to, regs, dsc); + arm_process_displaced_insn (gdbarch, from, to, regs, dsc.get ()); } - arm_displaced_init_closure (gdbarch, from, to, dsc); + arm_displaced_init_closure (gdbarch, from, to, dsc.get ()); - return dsc; + /* This is a work around for a problem with g++ 4.8. */ + return displaced_step_copy_insn_closure_up (dsc.release ()); } /* Implementation of `gdbarch_stap_is_single_operand', as defined in @@ -1711,11 +1712,11 @@ arm_linux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) /* Implement the gcc_target_options gdbarch method. */ -static char * +static std::string arm_linux_gcc_target_options (struct gdbarch *gdbarch) { /* GCC doesn't know "-m32". */ - return NULL; + return {}; } static void @@ -2002,8 +2003,9 @@ arm_linux_init_abi (struct gdbarch_info info, set_gdbarch_gcc_target_options (gdbarch, arm_linux_gcc_target_options); } +void _initialize_arm_linux_tdep (); void -_initialize_arm_linux_tdep (void) +_initialize_arm_linux_tdep () { gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_LINUX, arm_linux_init_abi);