gdb: introduce displaced_step_closure_up type alias

To help with readability, add the type displaced_step_closure_up, an
alias for std::unique_ptr<displaced_step_closure>, and use it throughout
the code base.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Use
	displaced_step_closure_up.
	* aarch64-tdep.h (aarch64_displaced_step_copy_insn): Likewise.
	(struct displaced_step_closure_up):
	* amd64-tdep.c (amd64_displaced_step_copy_insn): Likewise.
	* amd64-tdep.h (amd64_displaced_step_copy_insn): Likewise.
	* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn):
	Likewise.
	* gdbarch.sh (displaced_step_copy_insn): Likewise.
	* gdbarch.c, gdbarch.h: Re-generate.
	* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Use
	displaced_step_closure_up.
	* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
	* i386-tdep.h (i386_displaced_step_copy_insn): Likewise.
	* infrun.h (displaced_step_closure_up): New type alias.
	(struct displaced_step_inferior_state) <step_closure>: Change
	type to displaced_step_closure_up.
	* rs6000-tdep.c (ppc_displaced_step_copy_insn): Use
	displaced_step_closure_up.
	* s390-tdep.c (s390_displaced_step_copy_insn): Likewise.
This commit is contained in:
Simon Marchi
2020-02-14 16:45:40 -05:00
parent 1a627e7e6c
commit fdb61c6c39
15 changed files with 46 additions and 18 deletions

View File

@@ -36,6 +36,7 @@
#include "symtab.h"
#include "arch-utils.h"
#include "xml-syscall.h"
#include "infrun.h"
#include "i387-tdep.h"
#include "gdbsupport/x86-xstate.h"
@@ -797,12 +798,12 @@ i386_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
which does not seem worth it. The same effect is achieved by patching that
'nop' instruction there instead. */
static std::unique_ptr<displaced_step_closure>
static displaced_step_closure_up
i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
std::unique_ptr<displaced_step_closure> closure_
displaced_step_closure_up closure_
= i386_displaced_step_copy_insn (gdbarch, from, to, regs);
if (i386_linux_get_syscall_number_from_regcache (regs) != -1)