gdb: introduce displaced_step_closure_up type alias
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 14 Feb 2020 21:45:40 +0000 (16:45 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 10 Jun 2020 21:25:49 +0000 (17:25 -0400)
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.

15 files changed:
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/aarch64-tdep.h
gdb/amd64-tdep.c
gdb/amd64-tdep.h
gdb/arm-linux-tdep.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/i386-linux-tdep.c
gdb/i386-tdep.c
gdb/i386-tdep.h
gdb/infrun.h
gdb/rs6000-tdep.c
gdb/s390-tdep.c

index eb843fdd99bf036997c8a9a4440895895745fab5..adf86d546ec88eaefb9b03d44a0816ac59be8511 100644 (file)
@@ -1,3 +1,26 @@
+2020-02-14  Simon Marchi  <simon.marchi@efficios.com>
+
+       * 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.
+
 2020-02-14  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbarch.sh (displaced_step_copy_insn): Change return type to an
index 1a248d2a9ef8bd3cb8af8112216ef1eed24b31a6..15de1f50bb8c3226e369ffb7f3f7a16f7eeb5078 100644 (file)
@@ -2965,7 +2965,7 @@ static const struct aarch64_insn_visitor visitor =
 
 /* Implement the "displaced_step_copy_insn" gdbarch method.  */
 
-std::unique_ptr<displaced_step_closure>
+displaced_step_closure_up
 aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
                                  CORE_ADDR from, CORE_ADDR to,
                                  struct regcache *regs)
index fc397967cd8eef0701c77d2465b748e98c7d8ca1..f6ebabeaeb95b49010c0e70cfd9ca714e554a52f 100644 (file)
@@ -23,6 +23,7 @@
 #define AARCH64_TDEP_H
 
 #include "arch/aarch64.h"
+#include "infrun.h"
 
 /* Forward declarations.  */
 struct gdbarch;
@@ -106,7 +107,7 @@ 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);
 
-struct std::unique_ptr<displaced_step_closure>
+displaced_step_closure_up
   aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
                                    CORE_ADDR from, CORE_ADDR to,
                                    struct regcache *regs);
index cfad4f724a76eba0b457c83ea90ff5a43fdfa7cc..69f71ddb1ce9859c8b65062c3b777633c3bffbba 100644 (file)
@@ -1465,7 +1465,7 @@ fixup_displaced_copy (struct gdbarch *gdbarch,
     }
 }
 
-std::unique_ptr<displaced_step_closure>
+displaced_step_closure_up
 amd64_displaced_step_copy_insn (struct gdbarch *gdbarch,
                                CORE_ADDR from, CORE_ADDR to,
                                struct regcache *regs)
index 33ef0c3cea7e8e875df8e97033e9a205a61d4bdf..44c1250cb915cfce71ee15ded244069ac9c5adb2 100644 (file)
@@ -26,6 +26,7 @@ struct frame_info;
 struct regcache;
 
 #include "i386-tdep.h"
+#include "infrun.h"
 
 /* Register numbers of various important registers.  */
 
@@ -87,7 +88,7 @@ enum amd64_regnum
 
 #define AMD64_NUM_REGS         (AMD64_GSBASE_REGNUM + 1)
 
-extern std::unique_ptr<displaced_step_closure> amd64_displaced_step_copy_insn
+extern displaced_step_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,
index daad1b7c167e217c2722b29822b0ff3899248e77..7fe84d33e69713587ff66fd3c5320e172090b342 100644 (file)
@@ -1103,7 +1103,7 @@ 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 std::unique_ptr<displaced_step_closure>
+static displaced_step_closure_up
 arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
                                    CORE_ADDR from, CORE_ADDR to,
                                    struct regcache *regs)
index f715dc435ab5540924972024002fe324803ae863..252e6809036671e17c86a8e6287adf12f6e798f7 100644 (file)
@@ -3930,7 +3930,7 @@ gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch)
   return gdbarch->displaced_step_copy_insn != NULL;
 }
 
-std::unique_ptr<displaced_step_closure>
+displaced_step_closure_up
 gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
 {
   gdb_assert (gdbarch != NULL);
index de031cc8c16de3f78ee52ac10c9bdf89a63eefc2..61fa7ed1c4ef0ff26eebcccb5f54b60255b7437e 100644 (file)
@@ -39,6 +39,7 @@
 #include "frame.h"
 #include "dis-asm.h"
 #include "gdb_obstack.h"
+#include "infrun.h"
 
 struct floatformat;
 struct ui_file;
@@ -55,7 +56,6 @@ struct obstack;
 struct bp_target_info;
 struct target_desc;
 struct symbol;
-struct displaced_step_closure;
 struct syscall;
 struct agent_expr;
 struct axs_value;
@@ -1036,8 +1036,8 @@ extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_i
 
 extern int gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch);
 
-typedef std::unique_ptr<displaced_step_closure> (gdbarch_displaced_step_copy_insn_ftype) (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
-extern std::unique_ptr<displaced_step_closure> gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
+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);
 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
index ba7a557f03a6043b43cf8f2aaca4d94f0c9f6033..82cf4744838c16ae8d2fa08e90d959ace430b612 100755 (executable)
@@ -816,7 +816,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;std::unique_ptr<displaced_step_closure>;displaced_step_copy_insn;CORE_ADDR from, CORE_ADDR to, struct regcache *regs;from, to, regs
+M;displaced_step_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
 # the displaced instruction identified by CLOSURE.  If false,
@@ -1308,6 +1308,7 @@ cat <<EOF
 #include "frame.h"
 #include "dis-asm.h"
 #include "gdb_obstack.h"
+#include "infrun.h"
 
 struct floatformat;
 struct ui_file;
@@ -1324,7 +1325,6 @@ struct obstack;
 struct bp_target_info;
 struct target_desc;
 struct symbol;
-struct displaced_step_closure;
 struct syscall;
 struct agent_expr;
 struct axs_value;
index 7baa705225aa9fd2972d90369296097575fa62c3..e22075843b23a93424bc8a61bc4f63e2e8c8e5e8 100644 (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)
index fdad3ea2efe55cc2a67294ac341ead008c25dc37..5ca1b9402a5539e20e0c449b37883bef8bb89fe6 100644 (file)
@@ -798,7 +798,7 @@ i386_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
 
 /* Some kernels may run one past a syscall insn, so we have to cope.  */
 
-std::unique_ptr<displaced_step_closure>
+displaced_step_closure_up
 i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
                               CORE_ADDR from, CORE_ADDR to,
                               struct regcache *regs)
index 41faf515868dcac7c298b94394cbe7dde0e4df64..fa29e316a19bd384bebf6cafe15dc33d68116bc6 100644 (file)
@@ -428,7 +428,7 @@ extern void
 
 typedef buf_displaced_step_closure i386_displaced_step_closure;
 
-extern std::unique_ptr<displaced_step_closure> i386_displaced_step_copy_insn
+extern displaced_step_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,
index 707709cb850e136819b14f91b2437a6ea7f90adc..1517beb0d3eed209b5d5d54e6ac1b772c12d882c 100644 (file)
@@ -248,6 +248,8 @@ struct displaced_step_closure
   virtual ~displaced_step_closure () = 0;
 };
 
+using displaced_step_closure_up = std::unique_ptr<displaced_step_closure>;
+
 /* A simple displaced step closure that contains only a byte buffer.  */
 
 struct buf_displaced_step_closure : displaced_step_closure
@@ -293,7 +295,7 @@ struct displaced_step_inferior_state
 
   /* The closure provided gdbarch_displaced_step_copy_insn, to be used
      for post-step cleanup.  */
-  std::unique_ptr<displaced_step_closure> step_closure;
+  displaced_step_closure_up step_closure;
 
   /* The address of the original instruction, and the copy we
      made.  */
index e4bbb591f472b99667af81cdcff2f60d346792dd..d1e3976d9a996fc7e89ce3bb2275e7cbc3c074e3 100644 (file)
@@ -855,7 +855,7 @@ typedef buf_displaced_step_closure ppc_displaced_step_closure;
 
 /* We can't displaced step atomic sequences.  */
 
-static std::unique_ptr<displaced_step_closure>
+static displaced_step_closure_up
 ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,
                              CORE_ADDR from, CORE_ADDR to,
                              struct regcache *regs)
index 2d7cd370a3af77ed126a934b3b8a1218f6a5996a..39f9a48d545bc0cceab9705b0790ec5b6bee2441 100644 (file)
@@ -425,7 +425,7 @@ typedef buf_displaced_step_closure s390_displaced_step_closure;
 
 /* Implementation of gdbarch_displaced_step_copy_insn.  */
 
-static std::unique_ptr<displaced_step_closure>
+static displaced_step_closure_up
 s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
                               CORE_ADDR from, CORE_ADDR to,
                               struct regcache *regs)
This page took 0.03638 seconds and 4 git commands to generate.