From: Simon Marchi Date: Fri, 13 Oct 2017 01:42:05 +0000 (-0400) Subject: Remove simple_displaced_step_copy_insn X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2508e905f956c5a5e0d2a7fff58b4c746180237;p=binutils-gdb.git Remove simple_displaced_step_copy_insn Nothing uses this function. Remove it, and adjust comments referring to it. gdb/ChangeLog: * arch-utils.h (simple_displaced_step_copy_insn): Remove. * arch-utils.c (simple_displaced_step_copy_insn): Remove. * gdbarch.sh (displaced_step_copy_insn): Adjust comment. * gdbarch.h: Regenerate. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust comment. * i386-tdep.c (i386_displaced_step_copy_insn): Adjust comment. (i386_displaced_step_fixup): Adjust comment. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Adjust comment. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 65a32657371..032d8d39cf0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2017-10-12 Simon Marchi + + * arch-utils.h (simple_displaced_step_copy_insn): Remove. + * arch-utils.c (simple_displaced_step_copy_insn): Remove. + * gdbarch.sh (displaced_step_copy_insn): Adjust comment. + * gdbarch.h: Regenerate. + * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): + Adjust comment. + * i386-tdep.c (i386_displaced_step_copy_insn): Adjust comment. + (i386_displaced_step_fixup): Adjust comment. + * rs6000-tdep.c (ppc_displaced_step_copy_insn): Adjust comment. + 2017-10-12 Tom Tromey * prologue-value.h (pv_area::store_would_trash): Return bool. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 02ffd6b574f..6bdcc0126d5 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -39,27 +39,6 @@ #include "dis-asm.h" -struct displaced_step_closure * -simple_displaced_step_copy_insn (struct gdbarch *gdbarch, - CORE_ADDR from, CORE_ADDR to, - struct regcache *regs) -{ - size_t len = gdbarch_max_insn_length (gdbarch); - gdb_byte *buf = (gdb_byte *) xmalloc (len); - - read_memory (from, buf, len); - write_memory (to, buf, len); - - if (debug_displaced) - { - fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ", - paddress (gdbarch, from), paddress (gdbarch, to)); - displaced_step_dump_bytes (gdb_stdlog, buf, len); - } - - return (struct displaced_step_closure *) buf; -} - int default_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure) diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index fa2908605f5..6d3c3629ef5 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -73,18 +73,6 @@ struct bp_manipulation_endian bp_manipulation_endian -/* An implementation of gdbarch_displaced_step_copy_insn for - processors that don't need to modify the instruction before - single-stepping the displaced copy. - - Simply copy gdbarch_max_insn_length (ARCH) bytes from FROM to TO. - The closure is an array of that many bytes containing the - instruction's bytes, allocated with xmalloc. */ -extern struct displaced_step_closure * - simple_displaced_step_copy_insn (struct gdbarch *gdbarch, - CORE_ADDR from, CORE_ADDR to, - struct regcache *regs); - /* Default implementation of gdbarch_displaced_hw_singlestep. */ extern int default_displaced_step_hw_singlestep (struct gdbarch *, diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f276d09a661..d2e6b6f63ec 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -984,10 +984,6 @@ extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_i If you do not provide this function, GDB assumes that the architecture does not support displaced stepping. - If your architecture doesn't need to adjust instructions before - single-stepping them, consider using simple_displaced_step_copy_insn - here. - If the instruction cannot execute out of line, return NULL. The core falls back to stepping past the instruction in-line instead in that case. */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index ea15c8c1b51..6459b12747b 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -793,10 +793,6 @@ V;ULONGEST;max_insn_length;;;0;0 # If you do not provide this function, GDB assumes that the # architecture does not support displaced stepping. # -# If your architecture doesn't need to adjust instructions before -# single-stepping them, consider using simple_displaced_step_copy_insn -# here. -# # If the instruction cannot execute out of line, return NULL. The # core falls back to stepping past the instruction in-line instead in # that case. diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 87a9598f8af..8cec6753f06 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -803,13 +803,13 @@ i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, struct regcache *regs) { struct displaced_step_closure *closure; - + closure = i386_displaced_step_copy_insn (gdbarch, from, to, regs); if (i386_linux_get_syscall_number_from_regcache (regs) != -1) { - /* Since we use simple_displaced_step_copy_insn, our closure is a - copy of the instruction. */ + /* The closure returned by i386_displaced_step_copy_insn is simply a + buffer with a copy of the instruction. */ gdb_byte *insn = (gdb_byte *) closure; /* Fake nop. */ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 9eb1192ff5b..46e5e32f0a6 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -794,8 +794,7 @@ i386_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr) return i386_jmp_p (insn); } -/* Some kernels may run one past a syscall insn, so we have to cope. - Otherwise this is just simple_displaced_step_copy_insn. */ +/* Some kernels may run one past a syscall insn, so we have to cope. */ struct displaced_step_closure * i386_displaced_step_copy_insn (struct gdbarch *gdbarch, @@ -848,8 +847,7 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch, applying it. */ ULONGEST insn_offset = to - from; - /* Since we use simple_displaced_step_copy_insn, our closure is a - copy of the instruction. */ + /* Our closure is a copy of the instruction. */ gdb_byte *insn = (gdb_byte *) closure; /* The start of the insn, needed in case we see some prefixes. */ gdb_byte *insn_start = insn; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 92395adb1a2..df1a84d76ed 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1014,8 +1014,7 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint) || (insn & STORE_CONDITIONAL_MASK) == STHCX_INSTRUCTION \ || (insn & STORE_CONDITIONAL_MASK) == STQCX_INSTRUCTION) -/* We can't displaced step atomic sequences. Otherwise this is just - like simple_displaced_step_copy_insn. */ +/* We can't displaced step atomic sequences. */ static struct displaced_step_closure * ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,