diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-02-14 15:29:08 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-02-14 15:29:08 -0500 |
commit | e8217e61f5952ccfdabb0c4ee0c237a363e9bd99 (patch) | |
tree | 19aca9edacd70c4cfb8e8d6333ccaddb536b3584 /gdb/arm-linux-tdep.c | |
parent | d8d83535e6d3dbb3fb8664f6a98a37470c091f01 (diff) | |
download | gdb-e8217e61f5952ccfdabb0c4ee0c237a363e9bd99.zip gdb-e8217e61f5952ccfdabb0c4ee0c237a363e9bd99.tar.gz gdb-e8217e61f5952ccfdabb0c4ee0c237a363e9bd99.tar.bz2 |
gdb: make gdbarch_displaced_step_copy_insn return an std::unique_ptr
This callback dynamically allocates a specialized displaced_step_closure, and
gives the ownership of the object to its caller. So I think it would make
sense for the callback to return an std::unique_ptr, this is what this patch
implements.
gdb/ChangeLog:
* gdbarch.sh (displaced_step_copy_insn): Change return type to an
std::unique_ptr.
* gdbarch.c: Re-generate.
* gdbarch.h: Re-generate.
* infrun.c (displaced_step_prepare_throw): Adjust to std::unique_ptr
change.
* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Change return
type to std::unique_ptr.
* aarch64-tdep.h (aarch64_displaced_step_copy_insn): Likewise.
* 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.
* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
* i386-tdep.h (i386_displaced_step_copy_insn): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
* s390-tdep.c (s390_displaced_step_copy_insn): Likewise.
Diffstat (limited to 'gdb/arm-linux-tdep.c')
-rw-r--r-- | gdb/arm-linux-tdep.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 363e671..b3ae04f 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -1103,12 +1103,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 struct displaced_step_closure * +static std::unique_ptr<displaced_step_closure> arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { - arm_displaced_step_closure *dsc = new arm_displaced_step_closure; + std::unique_ptr<arm_displaced_step_closure> dsc + (new arm_displaced_step_closure); /* Detect when we enter an (inaccessible by GDB) Linux kernel helper, and stop at the return location. */ @@ -1118,17 +1119,17 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, fprintf_unfiltered (gdb_stdlog, "displaced: detected kernel helper " "at %.8lx\n", (unsigned long) from); - arm_catch_kernel_helper_return (gdbarch, from, to, regs, dsc); + arm_catch_kernel_helper_return (gdbarch, from, to, regs, dsc.get ()); } else { /* Override the default handling of SVC instructions. */ dsc->u.svc.copy_svc_os = arm_linux_copy_svc; - arm_process_displaced_insn (gdbarch, from, to, regs, dsc); + arm_process_displaced_insn (gdbarch, from, to, regs, dsc.get ()); } - arm_displaced_init_closure (gdbarch, from, to, dsc); + arm_displaced_init_closure (gdbarch, from, to, dsc.get ()); return dsc; } |