+2017-10-12 Simon Marchi <simon.marchi@ericsson.com>
+
+ * 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 <tom@tromey.com>
* prologue-value.h (pv_area::store_would_trash): Return bool.
#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)
bp_manipulation_endian<sizeof (BREAK_INSN_LITTLE), \
BREAK_INSN_LITTLE, BREAK_INSN_BIG>
-/* 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 *,
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. */
# 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.
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. */
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,
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;
|| (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,