aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-02-14 15:29:08 -0500
committerSimon Marchi <simon.marchi@efficios.com>2020-02-14 15:29:08 -0500
commite8217e61f5952ccfdabb0c4ee0c237a363e9bd99 (patch)
tree19aca9edacd70c4cfb8e8d6333ccaddb536b3584 /gdb/infrun.c
parentd8d83535e6d3dbb3fb8664f6a98a37470c091f01 (diff)
downloadbinutils-e8217e61f5952ccfdabb0c4ee0c237a363e9bd99.zip
binutils-e8217e61f5952ccfdabb0c4ee0c237a363e9bd99.tar.gz
binutils-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/infrun.c')
-rw-r--r--gdb/infrun.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index e3e4bdb..d9a6f73 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1646,7 +1646,6 @@ displaced_step_prepare_throw (thread_info *tp)
const address_space *aspace = regcache->aspace ();
CORE_ADDR original, copy;
ULONGEST len;
- struct displaced_step_closure *closure;
int status;
/* We should never reach this function if the architecture does not
@@ -1738,9 +1737,9 @@ displaced_step_prepare_throw (thread_info *tp)
len);
};
- closure = gdbarch_displaced_step_copy_insn (gdbarch,
- original, copy, regcache);
- if (closure == NULL)
+ displaced->step_closure
+ = gdbarch_displaced_step_copy_insn (gdbarch, original, copy, regcache);
+ if (displaced->step_closure == NULL)
{
/* The architecture doesn't know how or want to displaced step
this instruction or instruction sequence. Fallback to
@@ -1752,7 +1751,6 @@ displaced_step_prepare_throw (thread_info *tp)
succeeds. */
displaced->step_thread = tp;
displaced->step_gdbarch = gdbarch;
- displaced->step_closure.reset (closure);
displaced->step_original = original;
displaced->step_copy = copy;