Commit 1152d984 authored by Simon Marchi's avatar Simon Marchi
Browse files

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
parent 28d5518b
2020-12-04 Simon Marchi <simon.marchi@efficios.com>
* 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 <simon.marchi@efficios.com>
* gdbthread.h (thread_step_over_chain_enqueue): Rename to...
......
......@@ -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<aarch64_displaced_step_closure> dsc
(new aarch64_displaced_step_closure);
std::unique_ptr<aarch64_displaced_step_copy_insn_closure> 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;
......
......@@ -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);
......
......@@ -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<amd64_displaced_step_closure> dsc
(new amd64_displaced_step_closure (len + fixup_sentinel_space));
std::unique_ptr<amd64_displaced_step_copy_insn_closure> 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;
......
......@@ -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. */
......
......@@ -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<arm_displaced_step_closure> dsc
(new arm_displaced_step_closure);
std::unique_ptr<arm_displaced_step_copy_insn_closure> 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
......
This diff is collapsed.
......@@ -149,7 +149,8 @@ struct gdbarch_tdep
sequence) and any scratch words, etc. */
#define ARM_DISPLACED_MODIFIED_INSNS 8
struct arm_displaced_step_closure : public displaced_step_closure
struct arm_displaced_step_copy_insn_closure
: public displaced_step_copy_insn_closure
{
ULONGEST tmp[DISPLACED_TEMPS];
int rd;
......@@ -196,7 +197,7 @@ struct arm_displaced_step_closure : public displaced_step_closure
/* If non-NULL, override generic SVC handling (e.g. for a particular
OS). */
int (*copy_svc_os) (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_closure *dsc);
arm_displaced_step_copy_insn_closure *dsc);
} svc;
} u;
......@@ -215,7 +216,7 @@ struct arm_displaced_step_closure : public displaced_step_closure
CORE_ADDR insn_addr;
CORE_ADDR scratch_base;
void (*cleanup) (struct gdbarch *, struct regcache *,
arm_displaced_step_closure *);
arm_displaced_step_copy_insn_closure *);
};
/* Values for the WRITE_PC argument to displaced_write_reg. If the register
......@@ -234,16 +235,17 @@ enum pc_write_style
extern void
arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
CORE_ADDR to, struct regcache *regs,
arm_displaced_step_closure *dsc);
arm_displaced_step_copy_insn_closure *dsc);
extern void
arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
CORE_ADDR to, arm_displaced_step_closure *dsc);
CORE_ADDR to,
arm_displaced_step_copy_insn_closure *dsc);
extern 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);
extern void
displaced_write_reg (struct regcache *regs,
arm_displaced_step_closure *dsc, int regno,
arm_displaced_step_copy_insn_closure *dsc, int regno,
ULONGEST val, enum pc_write_style write_pc);
CORE_ADDR arm_skip_stub (struct frame_info *, CORE_ADDR);
......@@ -262,7 +264,7 @@ int arm_is_thumb (struct regcache *regcache);
int arm_frame_is_thumb (struct frame_info *frame);
extern void arm_displaced_step_fixup (struct gdbarch *,
struct displaced_step_closure *,
displaced_step_copy_insn_closure *,
CORE_ADDR, CORE_ADDR, struct regcache *);
/* Return the bit mask in ARM_PS_REGNUM that indicates Thumb mode. */
......
......@@ -3969,7 +3969,7 @@ gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch)
return gdbarch->displaced_step_copy_insn != NULL;
}
displaced_step_closure_up
displaced_step_copy_insn_closure_up
gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
{
gdb_assert (gdbarch != NULL);
......@@ -4011,7 +4011,7 @@ gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch)
}
void
gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->displaced_step_fixup != NULL);
......
......@@ -1030,8 +1030,8 @@ extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_i
extern bool gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch);
typedef displaced_step_closure_up (gdbarch_displaced_step_copy_insn_ftype) (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
extern displaced_step_closure_up gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
typedef displaced_step_copy_insn_closure_up (gdbarch_displaced_step_copy_insn_ftype) (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
extern displaced_step_copy_insn_closure_up gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn);
/* Return true if GDB should use hardware single-stepping to execute a displaced
......@@ -1066,8 +1066,8 @@ extern void set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, g
extern bool gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch);
typedef void (gdbarch_displaced_step_fixup_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
extern void gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
typedef void (gdbarch_displaced_step_fixup_ftype) (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
extern void gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
extern void set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype *displaced_step_fixup);
/* Return the address of an appropriate place to put displaced
......
......@@ -783,7 +783,7 @@ V;ULONGEST;max_insn_length;;;0;0
# 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.
M;displaced_step_closure_up;displaced_step_copy_insn;CORE_ADDR from, CORE_ADDR to, struct regcache *regs;from, to, regs
M;displaced_step_copy_insn_closure_up;displaced_step_copy_insn;CORE_ADDR from, CORE_ADDR to, struct regcache *regs;from, to, regs
# Return true if GDB should use hardware single-stepping to execute a displaced
# step instruction. If false, GDB will simply restart execution at the
......@@ -811,7 +811,7 @@ m;bool;displaced_step_hw_singlestep;void;;;default_displaced_step_hw_singlestep;
#
# For a general explanation of displaced stepping and how GDB uses it,
# see the comments in infrun.c.
M;void;displaced_step_fixup;struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs;closure, from, to, regs;;NULL
M;void;displaced_step_fixup;struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs;closure, from, to, regs;;NULL
# Return the address of an appropriate place to put displaced
# instructions while we step over them. There need only be one such
......
......@@ -789,29 +789,30 @@ i386_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
PC should get relocated back to its vDSO address. Hide the 'ret'
instruction by 'nop' so that i386_displaced_step_fixup is not confused.
It is not fully correct as the bytes in struct displaced_step_closure will
not match the inferior code. But we would need some new flag in
displaced_step_closure otherwise to keep the state that syscall is finishing
for the later i386_displaced_step_fixup execution as the syscall execution
is already no longer detectable there. The new flag field would mean
i386-linux-tdep.c needs to wrap all the displacement methods of i386-tdep.c
which does not seem worth it. The same effect is achieved by patching that
'nop' instruction there instead. */
static displaced_step_closure_up
It is not fully correct as the bytes in struct
displaced_step_copy_insn_closure will not match the inferior code. But we
would need some new flag in displaced_step_copy_insn_closure otherwise to
keep the state that syscall is finishing for the later
i386_displaced_step_fixup execution as the syscall execution is already no
longer detectable there. The new flag field would mean i386-linux-tdep.c
needs to wrap all the displacement methods of i386-tdep.c which does not seem
worth it. The same effect is achieved by patching that 'nop' instruction
there instead. */
static displaced_step_copy_insn_closure_up
i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
displaced_step_closure_up closure_
displaced_step_copy_insn_closure_up closure_
= i386_displaced_step_copy_insn (gdbarch, from, to, regs);
if (i386_linux_get_syscall_number_from_regcache (regs) != -1)
{
/* The closure returned by i386_displaced_step_copy_insn is simply a
buffer with a copy of the instruction. */
i386_displaced_step_closure *closure
= (i386_displaced_step_closure *) closure_.get ();
i386_displaced_step_copy_insn_closure *closure
= (i386_displaced_step_copy_insn_closure *) closure_.get ();
/* Fake nop. */
closure->buf[0] = 0x90;
......
......@@ -799,14 +799,14 @@ i386_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
/* Some kernels may run one past a syscall insn, so we have to cope. */
displaced_step_closure_up
displaced_step_copy_insn_closure_up
i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
std::unique_ptr<i386_displaced_step_closure> closure
(new i386_displaced_step_closure (len));
std::unique_ptr<i386_displaced_step_copy_insn_closure> closure
(new i386_displaced_step_copy_insn_closure (len));
gdb_byte *buf = closure->buf.data ();
read_memory (from, buf, len);
......@@ -830,7 +830,7 @@ i386_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 (closure.release ());
return displaced_step_copy_insn_closure_up (closure.release ());
}
/* Fix up the state of registers and memory after having single-stepped
......@@ -838,7 +838,7 @@ i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
void
i386_displaced_step_fixup (struct gdbarch *gdbarch,
struct displaced_step_closure *closure_,
struct displaced_step_copy_insn_closure *closure_,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
......@@ -850,8 +850,8 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch,
applying it. */
ULONGEST insn_offset = to - from;
i386_displaced_step_closure *closure
= (i386_displaced_step_closure *) closure_;
i386_displaced_step_copy_insn_closure *closure
= (i386_displaced_step_copy_insn_closure *) closure_;
gdb_byte *insn = closure->buf.data ();
/* The start of the insn, needed in case we see some prefixes. */
gdb_byte *insn_start = insn;
......
......@@ -439,15 +439,15 @@ extern void
void *cb_data,
const struct regcache *regcache);
typedef buf_displaced_step_closure i386_displaced_step_closure;
typedef buf_displaced_step_copy_insn_closure
i386_displaced_step_copy_insn_closure;
extern displaced_step_closure_up i386_displaced_step_copy_insn
extern displaced_step_copy_insn_closure_up i386_displaced_step_copy_insn
(struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
struct regcache *regs);
extern void i386_displaced_step_fixup (struct gdbarch *gdbarch,
struct displaced_step_closure *closure,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs);
extern void i386_displaced_step_fixup
(struct gdbarch *gdbarch, displaced_step_copy_insn_closure *closure,
CORE_ADDR from, CORE_ADDR to, regcache *regs);
/* Initialize a basic ELF architecture variant. */
extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
......
......@@ -1459,9 +1459,10 @@ step_over_info_valid_p (void)
displaced step operation on it. See displaced_step_prepare and
displaced_step_fixup for details. */
/* Default destructor for displaced_step_closure. */
/* Default destructor for displaced_step_copy_insn_closure. */
displaced_step_closure::~displaced_step_closure () = default;
displaced_step_copy_insn_closure::~displaced_step_copy_insn_closure ()
= default;
/* Returns true if any inferior has a thread doing a displaced
step. */
......@@ -1497,11 +1498,11 @@ displaced_step_in_progress (inferior *inf)
}
/* If inferior is in displaced stepping, and ADDR equals to starting address
of copy area, return corresponding displaced_step_closure. Otherwise,
return NULL. */
of copy area, return corresponding displaced_step_copy_insn_closure.
Otherwise, return NULL. */
struct displaced_step_closure*
get_displaced_step_closure_by_addr (CORE_ADDR addr)
displaced_step_copy_insn_closure *
get_displaced_step_copy_insn_closure_by_addr (CORE_ADDR addr)
{
displaced_step_inferior_state &displaced
= current_inferior ()->displaced_step_state;
......
......@@ -239,8 +239,8 @@ extern void clear_exit_convenience_vars (void);
/* Dump LEN bytes at BUF in hex to a string and return it. */
extern std::string displaced_step_dump_bytes (const gdb_byte *buf, size_t len);
extern struct displaced_step_closure *get_displaced_step_closure_by_addr
(CORE_ADDR addr);
extern struct displaced_step_copy_insn_closure *
get_displaced_step_copy_insn_closure_by_addr (CORE_ADDR addr);
extern void update_observer_mode (void);
......@@ -282,18 +282,19 @@ extern void all_uis_on_sync_execution_starting (void);
/* Base class for displaced stepping closures (the arch-specific data). */
struct displaced_step_closure
struct displaced_step_copy_insn_closure
{
virtual ~displaced_step_closure () = 0;
virtual ~displaced_step_copy_insn_closure () = 0;
};
using displaced_step_closure_up = std::unique_ptr<displaced_step_closure>;
using displaced_step_copy_insn_closure_up
= std::unique_ptr<displaced_step_copy_insn_closure>;
/* A simple displaced step closure that contains only a byte buffer. */
struct buf_displaced_step_closure : displaced_step_closure
struct buf_displaced_step_copy_insn_closure : displaced_step_copy_insn_closure
{
buf_displaced_step_closure (int buf_size)
buf_displaced_step_copy_insn_closure (int buf_size)
: buf (buf_size)
{}
......@@ -334,7 +335,7 @@ struct displaced_step_inferior_state
/* The closure provided gdbarch_displaced_step_copy_insn, to be used
for post-step cleanup. */
displaced_step_closure_up step_closure;
displaced_step_copy_insn_closure_up step_closure;
/* The address of the original instruction, and the copy we
made. */
......
......@@ -851,18 +851,19 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint)
|| (insn & STORE_CONDITIONAL_MASK) == STHCX_INSTRUCTION \
|| (insn & STORE_CONDITIONAL_MASK) == STQCX_INSTRUCTION)
typedef buf_displaced_step_closure ppc_displaced_step_closure;
typedef buf_displaced_step_copy_insn_closure
ppc_displaced_step_copy_insn_closure;
/* We can't displaced step atomic sequences. */
static displaced_step_closure_up
static displaced_step_copy_insn_closure_up
ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
std::unique_ptr<ppc_displaced_step_closure> closure
(new ppc_displaced_step_closure (len));
std::unique_ptr<ppc_displaced_step_copy_insn_closure> closure
(new ppc_displaced_step_copy_insn_closure (len));
gdb_byte *buf = closure->buf.data ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int insn;
......@@ -887,20 +888,21 @@ ppc_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 (closure.release ());
return displaced_step_copy_insn_closure_up (closure.release ());
}
/* Fix up the state of registers and memory after having single-stepped
a displaced instruction. */
static void
ppc_displaced_step_fixup (struct gdbarch *gdbarch,
struct displaced_step_closure *closure_,
struct displaced_step_copy_insn_closure *closure_,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Our closure is a copy of the instruction. */
ppc_displaced_step_closure *closure = (ppc_displaced_step_closure *) closure_;
ppc_displaced_step_copy_insn_closure *closure
= (ppc_displaced_step_copy_insn_closure *) closure_;
ULONGEST insn = extract_unsigned_integer (closure->buf.data (),
PPC_INSN_SIZE, byte_order);
ULONGEST opcode = 0;
......
......@@ -421,18 +421,19 @@ is_non_branch_ril (gdb_byte *insn)