From: Simon Marchi Date: Fri, 4 Dec 2020 21:43:53 +0000 (-0500) Subject: gdb: rename displaced_step_closure to displaced_step_copy_insn_closure X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1152d984bb1b66a9ff7d11f46583b6e0188b885b;p=binutils-gdb.git gdb: rename displaced_step_closure to displaced_step_copy_insn_closure Since we're going to introduce other "displaced step" functions and another kind of displaced step closure, make it clear that this is the return type of the gdbarch_displaced_step_copy_insn function. gdb/ChangeLog: * infrun.h (get_displaced_step_closure_by_addr): Rename to... (get_displaced_step_copy_insn_closure_by_addr): ... this. Update all users. (displaced_step_closure): Rename to... (displaced_step_copy_insn_closure): ... this. Update all users. (displaced_step_closure_up): Rename to... (displaced_step_copy_insn_closure_up). ... this. Update all users. (buf_displaced_step_closure): Rename to... (buf_displaced_step_copy_insn_closure): ... this. Update all users. * infrun.c (get_displaced_step_closure_by_addr): Rename to... (get_displaced_step_copy_insn_closure_by_addr): ... this. Update all users. * aarch64-tdep.c (aarch64_displaced_step_closure): Rename to... (aarch64_displaced_step_copy_insn_closure): ... this. Update all users. * amd64-tdep.c (amd64_displaced_step_closure): Rename to... (amd64_displaced_step_copy_insn_closure): ... this. Update all users. * arm-tdep.h (arm_displaced_step_closure): Rename to... (arm_displaced_step_copy_insn_closure): ... this. Update all users. * i386-tdep.h (i386_displaced_step_closure): Rename to... (i386_displaced_step_copy_insn_closure): ... this. Update all users. * rs6000-tdep.c (ppc_displaced_step_closure): Rename to... (ppc_displaced_step_copy_insn_closure): ... this. Update all users. * s390-tdep.c (s390_displaced_step_closure): Rename to... (s390_displaced_step_copy_insn_closure): ... this. Update all users. * gdbarch.h: Re-generate. * gdbarch.c: Re-generate. Change-Id: I11f56dbcd4c3532fb195a08ba93bccf1d12a03c8 --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 416f666a16b..a238bcdd048 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,40 @@ +2020-12-04 Simon Marchi + + * infrun.h (get_displaced_step_closure_by_addr): Rename to... + (get_displaced_step_copy_insn_closure_by_addr): ... this. + Update all users. + (displaced_step_closure): Rename to... + (displaced_step_copy_insn_closure): ... this. Update all users. + (displaced_step_closure_up): Rename to... + (displaced_step_copy_insn_closure_up). ... this. Update all + users. + (buf_displaced_step_closure): Rename to... + (buf_displaced_step_copy_insn_closure): ... this. Update all + users. + * infrun.c (get_displaced_step_closure_by_addr): Rename to... + (get_displaced_step_copy_insn_closure_by_addr): ... this. + Update all users. + * aarch64-tdep.c (aarch64_displaced_step_closure): Rename to... + (aarch64_displaced_step_copy_insn_closure): ... this. Update + all users. + * amd64-tdep.c (amd64_displaced_step_closure): Rename to... + (amd64_displaced_step_copy_insn_closure): ... this. Update all + users. + * arm-tdep.h (arm_displaced_step_closure): Rename to... + (arm_displaced_step_copy_insn_closure): ... this. Update all + users. + * i386-tdep.h (i386_displaced_step_closure): Rename to... + (i386_displaced_step_copy_insn_closure): ... this. Update all + users. + * rs6000-tdep.c (ppc_displaced_step_closure): Rename to... + (ppc_displaced_step_copy_insn_closure): ... this. Update all + users. + * s390-tdep.c (s390_displaced_step_closure): Rename to... + (s390_displaced_step_copy_insn_closure): ... this. Update all + users. + * gdbarch.h: Re-generate. + * gdbarch.c: Re-generate. + 2020-12-04 Simon Marchi * gdbthread.h (thread_step_over_chain_enqueue): Rename to... diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 680b53ffa6c..40c73be5028 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2899,7 +2899,8 @@ aarch64_software_single_step (struct regcache *regcache) return next_pcs; } -struct aarch64_displaced_step_closure : public displaced_step_closure +struct aarch64_displaced_step_copy_insn_closure + : public displaced_step_copy_insn_closure { /* It is true when condition instruction, such as B.CON, TBZ, etc, is being displaced stepping. */ @@ -2925,7 +2926,7 @@ struct aarch64_displaced_step_data /* Registers when doing displaced stepping. */ struct regcache *regs; - aarch64_displaced_step_closure *dsc; + aarch64_displaced_step_copy_insn_closure *dsc; }; /* Implementation of aarch64_insn_visitor method "b". */ @@ -3134,7 +3135,7 @@ static const struct aarch64_insn_visitor visitor = /* Implement the "displaced_step_copy_insn" gdbarch method. */ -displaced_step_closure_up +displaced_step_copy_insn_closure_up aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) @@ -3154,8 +3155,8 @@ aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, return NULL; } - std::unique_ptr dsc - (new aarch64_displaced_step_closure); + std::unique_ptr dsc + (new aarch64_displaced_step_copy_insn_closure); dsd.base.insn_addr = from; dsd.new_addr = to; dsd.regs = regs; @@ -3187,18 +3188,19 @@ aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, } /* This is a work around for a problem with g++ 4.8. */ - return displaced_step_closure_up (dsc.release ()); + return displaced_step_copy_insn_closure_up (dsc.release ()); } /* Implement the "displaced_step_fixup" gdbarch method. */ void aarch64_displaced_step_fixup (struct gdbarch *gdbarch, - struct displaced_step_closure *dsc_, + struct displaced_step_copy_insn_closure *dsc_, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { - aarch64_displaced_step_closure *dsc = (aarch64_displaced_step_closure *) dsc_; + aarch64_displaced_step_copy_insn_closure *dsc + = (aarch64_displaced_step_copy_insn_closure *) dsc_; ULONGEST pc; diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h index 81ce4d84b41..895aa5977f0 100644 --- a/gdb/aarch64-tdep.h +++ b/gdb/aarch64-tdep.h @@ -107,13 +107,13 @@ const target_desc *aarch64_read_description (uint64_t vq, bool pauth_p); extern int aarch64_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr); -displaced_step_closure_up +displaced_step_copy_insn_closure_up aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs); void aarch64_displaced_step_fixup (struct gdbarch *gdbarch, - struct displaced_step_closure *dsc, + displaced_step_copy_insn_closure *dsc, CORE_ADDR from, CORE_ADDR to, struct regcache *regs); diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 31d4d3460ef..d2bcbe199bc 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -1103,9 +1103,10 @@ struct amd64_insn gdb_byte *raw_insn; }; -struct amd64_displaced_step_closure : public displaced_step_closure +struct amd64_displaced_step_copy_insn_closure + : public displaced_step_copy_insn_closure { - amd64_displaced_step_closure (int insn_buf_len) + amd64_displaced_step_copy_insn_closure (int insn_buf_len) : insn_buf (insn_buf_len, 0) {} @@ -1386,7 +1387,8 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details) We set base = pc + insn_length so we can leave disp unchanged. */ static void -fixup_riprel (struct gdbarch *gdbarch, amd64_displaced_step_closure *dsc, +fixup_riprel (struct gdbarch *gdbarch, + amd64_displaced_step_copy_insn_closure *dsc, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { const struct amd64_insn *insn_details = &dsc->insn_details; @@ -1447,7 +1449,7 @@ fixup_riprel (struct gdbarch *gdbarch, amd64_displaced_step_closure *dsc, static void fixup_displaced_copy (struct gdbarch *gdbarch, - amd64_displaced_step_closure *dsc, + amd64_displaced_step_copy_insn_closure *dsc, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { const struct amd64_insn *details = &dsc->insn_details; @@ -1465,7 +1467,7 @@ fixup_displaced_copy (struct gdbarch *gdbarch, } } -displaced_step_closure_up +displaced_step_copy_insn_closure_up amd64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) @@ -1474,8 +1476,8 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch, /* Extra space for sentinels so fixup_{riprel,displaced_copy} don't have to continually watch for running off the end of the buffer. */ int fixup_sentinel_space = len; - std::unique_ptr dsc - (new amd64_displaced_step_closure (len + fixup_sentinel_space)); + std::unique_ptr dsc + (new amd64_displaced_step_copy_insn_closure (len + fixup_sentinel_space)); gdb_byte *buf = &dsc->insn_buf[0]; struct amd64_insn *details = &dsc->insn_details; @@ -1509,7 +1511,7 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch, displaced_step_dump_bytes (buf, len).c_str ()); /* This is a work around for a problem with g++ 4.8. */ - return displaced_step_closure_up (dsc.release ()); + return displaced_step_copy_insn_closure_up (dsc.release ()); } static int @@ -1671,11 +1673,12 @@ amd64_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr) void amd64_displaced_step_fixup (struct gdbarch *gdbarch, - struct displaced_step_closure *dsc_, + struct displaced_step_copy_insn_closure *dsc_, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { - amd64_displaced_step_closure *dsc = (amd64_displaced_step_closure *) dsc_; + amd64_displaced_step_copy_insn_closure *dsc + = (amd64_displaced_step_copy_insn_closure *) dsc_; enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); /* The offset we applied to the instruction's address. */ ULONGEST insn_offset = to - from; diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h index a4e69565593..56aef6c5d9a 100644 --- a/gdb/amd64-tdep.h +++ b/gdb/amd64-tdep.h @@ -88,13 +88,12 @@ enum amd64_regnum #define AMD64_NUM_REGS (AMD64_GSBASE_REGNUM + 1) -extern displaced_step_closure_up amd64_displaced_step_copy_insn +extern displaced_step_copy_insn_closure_up amd64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs); -extern void amd64_displaced_step_fixup (struct gdbarch *gdbarch, - struct displaced_step_closure *closure, - CORE_ADDR from, CORE_ADDR to, - struct regcache *regs); +extern void amd64_displaced_step_fixup + (struct gdbarch *gdbarch, displaced_step_copy_insn_closure *closure, + CORE_ADDR from, CORE_ADDR to, struct regcache *regs); /* Initialize the ABI for amd64. Uses DEFAULT_TDESC as fallback tdesc, if INFO does not specify one. */ diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 2d563c2b024..9caae06adfe 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -946,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; @@ -970,7 +970,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; @@ -1056,7 +1056,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); @@ -1065,7 +1065,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); @@ -1094,13 +1094,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 displaced_step_closure_up +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) { - std::unique_ptr 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. */ @@ -1122,7 +1122,7 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, arm_displaced_init_closure (gdbarch, from, to, dsc.get ()); /* This is a work around for a problem with g++ 4.8. */ - return displaced_step_closure_up (dsc.release ()); + return displaced_step_copy_insn_closure_up (dsc.release ()); } /* Implementation of `gdbarch_stap_is_single_operand', as defined in diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index d1e3a98c0b5..bc086e18a57 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -433,9 +433,9 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr) { struct bound_minimal_symbol sym; char type; - arm_displaced_step_closure *dsc - = ((arm_displaced_step_closure * ) - get_displaced_step_closure_by_addr (memaddr)); + arm_displaced_step_copy_insn_closure *dsc + = ((arm_displaced_step_copy_insn_closure * ) + get_displaced_step_copy_insn_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. */ @@ -4474,7 +4474,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr) location. */ ULONGEST -displaced_read_reg (struct regcache *regs, arm_displaced_step_closure *dsc, +displaced_read_reg (regcache *regs, arm_displaced_step_copy_insn_closure *dsc, int regno) { ULONGEST ret; @@ -4522,7 +4522,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, arm_displaced_step_closure *dsc, +branch_write_pc (regcache *regs, arm_displaced_step_copy_insn_closure *dsc, ULONGEST val) { if (!dsc->is_thumb) @@ -4568,7 +4568,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, arm_displaced_step_closure *dsc, +load_write_pc (regcache *regs, arm_displaced_step_copy_insn_closure *dsc, ULONGEST val) { if (DISPLACED_STEPPING_ARCH_VERSION >= 5) @@ -4580,7 +4580,7 @@ load_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc, /* Write to the PC as if from an ALU instruction. */ static void -alu_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc, +alu_write_pc (regcache *regs, arm_displaced_step_copy_insn_closure *dsc, ULONGEST val) { if (DISPLACED_STEPPING_ARCH_VERSION >= 7 && !dsc->is_thumb) @@ -4594,7 +4594,7 @@ alu_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc, this is controlled by the WRITE_PC argument. */ void -displaced_write_reg (struct regcache *regs, arm_displaced_step_closure *dsc, +displaced_write_reg (regcache *regs, arm_displaced_step_copy_insn_closure *dsc, int regno, ULONGEST val, enum pc_write_style write_pc) { if (regno == ARM_PC_REGNUM) @@ -4675,8 +4675,8 @@ insn_references_pc (uint32_t insn, uint32_t bitmask) matter what address they are executed at: in those cases, use this. */ static int -arm_copy_unmodified (struct gdbarch *gdbarch, uint32_t insn, - const char *iname, arm_displaced_step_closure *dsc) +arm_copy_unmodified (struct gdbarch *gdbarch, uint32_t insn, const char *iname, + arm_displaced_step_copy_insn_closure *dsc) { displaced_debug_printf ("copying insn %.8lx, opcode/class '%s' unmodified", (unsigned long) insn, iname); @@ -4689,7 +4689,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, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { displaced_debug_printf ("copying insn %.4x %.4x, opcode/class '%s' " "unmodified", insn1, insn2, iname); @@ -4706,7 +4706,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, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { displaced_debug_printf ("copying insn %.4x, opcode/class '%s' unmodified", insn, iname); @@ -4719,8 +4719,8 @@ thumb_copy_unmodified_16bit (struct gdbarch *gdbarch, uint16_t insn, /* Preload instructions with immediate offset. */ static void -cleanup_preload (struct gdbarch *gdbarch, - struct regcache *regs, arm_displaced_step_closure *dsc) +cleanup_preload (struct gdbarch *gdbarch, regcache *regs, + arm_displaced_step_copy_insn_closure *dsc) { displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC); if (!dsc->u.preload.immed) @@ -4729,7 +4729,7 @@ cleanup_preload (struct gdbarch *gdbarch, static void install_preload (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc, unsigned int rn) + arm_displaced_step_copy_insn_closure *dsc, unsigned int rn) { ULONGEST rn_val; /* Preload instructions: @@ -4748,7 +4748,7 @@ install_preload (struct gdbarch *gdbarch, struct regcache *regs, static int arm_copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { unsigned int rn = bits (insn, 16, 19); @@ -4766,7 +4766,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, arm_displaced_step_closure *dsc) + regcache *regs, arm_displaced_step_copy_insn_closure *dsc) { unsigned int rn = bits (insn1, 0, 3); unsigned int u_bit = bit (insn1, 7); @@ -4814,7 +4814,7 @@ thumb2_copy_preload (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2, static void install_preload_reg(struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc, unsigned int rn, + arm_displaced_step_copy_insn_closure *dsc, unsigned int rn, unsigned int rm) { ULONGEST rn_val, rm_val; @@ -4839,7 +4839,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, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { unsigned int rn = bits (insn, 16, 19); unsigned int rm = bits (insn, 0, 3); @@ -4862,7 +4862,7 @@ arm_copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn, static void cleanup_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { ULONGEST rn_val = displaced_read_reg (regs, dsc, 0); @@ -4874,7 +4874,7 @@ cleanup_copro_load_store (struct gdbarch *gdbarch, static void install_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc, + arm_displaced_step_copy_insn_closure *dsc, int writeback, unsigned int rn) { ULONGEST rn_val; @@ -4902,7 +4902,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, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { unsigned int rn = bits (insn, 16, 19); @@ -4922,7 +4922,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, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { unsigned int rn = bits (insn1, 0, 3); @@ -4949,7 +4949,7 @@ thumb2_copy_copro_load_store (struct gdbarch *gdbarch, uint16_t insn1, static void cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc) + arm_displaced_step_copy_insn_closure *dsc) { uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM); int branch_taken = condition_true (dsc->u.branch.cond, status); @@ -4980,7 +4980,7 @@ cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs, static void install_b_bl_blx (struct gdbarch *gdbarch, struct regcache *regs, - arm_displaced_step_closure *dsc, + arm_displaced_step_copy_insn_closure *dsc, unsigned int cond, int exchange, int link, long offset) { /* Implement "BL