]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, gdbserver: propagate use of target_desc unique pointers
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 17 Nov 2025 21:48:25 +0000 (16:48 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 1 Dec 2025 21:25:11 +0000 (16:25 -0500)
Propagate the use of target_desc unique pointers further.  Basically,
avoid releasing target_desc objects, except in some spots in gdbserver
(e.g. netbsd) where we don't currently have a persistent container for
created target descriptions (and the target desc just leaks).  Introduce
const_target_desc_up to change some `const target_desc *` to a unique
pointer without loss of constness.

Architectures that use the old regformats/regdat.sh don't need to be
changed, because their target_desc objects are statically allocated in
the generated files.

I was able to built-test these native configs:

 - Linux AArch64
 - Linux ARC
 - Linux AMD64
 - Linux ARM
 - Linux LoongArch
 - Linux M68K
 - Linux Microblaze
 - Linux MIPS (32 and 64)
 - Linux or1k
 - Linux PPC (32 and 64)
 - Linux RISC-V
 - Linux s390x
 - Linux SH4
 - Linux Sparc (32 and 64)
 - Linux Xtensa
 - FreeBSD AMD64
 - NetBSD AMD64
 - Windows i686
 - Windows AMD64

For the rest, I did my best by staring at the code long enough.  I
probably missed or messed some spots, but that shouldn't be difficult to
fix.

Change-Id: I8db8790c57942edd2bfe890987157e2dc0c67879
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
126 files changed:
gdb/aarch32-tdep.c
gdb/aarch64-tdep.c
gdb/alpha-tdep.c
gdb/amd64-tdep.c
gdb/arch/aarch32.c
gdb/arch/aarch32.h
gdb/arch/aarch64.c
gdb/arch/aarch64.h
gdb/arch/amd64-linux-tdesc.c
gdb/arch/amd64.c
gdb/arch/amd64.h
gdb/arch/arm.c
gdb/arch/arm.h
gdb/arch/i386-linux-tdesc.c
gdb/arch/i386.c
gdb/arch/i386.h
gdb/arch/loongarch.c
gdb/arch/ppc-linux-common.c
gdb/arch/ppc-linux-tdesc.h
gdb/arch/tic6x.c
gdb/arch/tic6x.h
gdb/arm-tdep.c
gdb/features/alpha.c
gdb/features/microblaze-linux.c
gdb/features/microblaze-with-stack-protect.c
gdb/features/microblaze.c
gdb/features/mips-dsp-linux.c
gdb/features/mips-linux.c
gdb/features/mips64-dsp-linux.c
gdb/features/mips64-linux.c
gdb/features/nds32.c
gdb/features/or1k-linux.c
gdb/features/or1k.c
gdb/features/rs6000/powerpc-32.c
gdb/features/rs6000/powerpc-32l.c
gdb/features/rs6000/powerpc-403.c
gdb/features/rs6000/powerpc-403gc.c
gdb/features/rs6000/powerpc-405.c
gdb/features/rs6000/powerpc-505.c
gdb/features/rs6000/powerpc-601.c
gdb/features/rs6000/powerpc-602.c
gdb/features/rs6000/powerpc-603.c
gdb/features/rs6000/powerpc-604.c
gdb/features/rs6000/powerpc-64.c
gdb/features/rs6000/powerpc-64l.c
gdb/features/rs6000/powerpc-7400.c
gdb/features/rs6000/powerpc-750.c
gdb/features/rs6000/powerpc-860.c
gdb/features/rs6000/powerpc-altivec32.c
gdb/features/rs6000/powerpc-altivec32l.c
gdb/features/rs6000/powerpc-altivec64.c
gdb/features/rs6000/powerpc-altivec64l.c
gdb/features/rs6000/powerpc-e500.c
gdb/features/rs6000/powerpc-e500l.c
gdb/features/rs6000/powerpc-isa205-32l.c
gdb/features/rs6000/powerpc-isa205-64l.c
gdb/features/rs6000/powerpc-isa205-altivec32l.c
gdb/features/rs6000/powerpc-isa205-altivec64l.c
gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c
gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c
gdb/features/rs6000/powerpc-isa205-vsx32l.c
gdb/features/rs6000/powerpc-isa205-vsx64l.c
gdb/features/rs6000/powerpc-isa207-htm-vsx32l.c
gdb/features/rs6000/powerpc-isa207-htm-vsx64l.c
gdb/features/rs6000/powerpc-isa207-vsx32l.c
gdb/features/rs6000/powerpc-isa207-vsx64l.c
gdb/features/rs6000/powerpc-vsx32.c
gdb/features/rs6000/powerpc-vsx32l.c
gdb/features/rs6000/powerpc-vsx64.c
gdb/features/rs6000/powerpc-vsx64l.c
gdb/features/rs6000/rs6000.c
gdb/features/rx.c
gdb/features/s390-gs-linux64.c
gdb/features/s390-linux32.c
gdb/features/s390-linux32v1.c
gdb/features/s390-linux32v2.c
gdb/features/s390-linux64.c
gdb/features/s390-linux64v1.c
gdb/features/s390-linux64v2.c
gdb/features/s390-te-linux64.c
gdb/features/s390-tevx-linux64.c
gdb/features/s390-vx-linux64.c
gdb/features/s390x-gs-linux64.c
gdb/features/s390x-linux64.c
gdb/features/s390x-linux64v1.c
gdb/features/s390x-linux64v2.c
gdb/features/s390x-te-linux64.c
gdb/features/s390x-tevx-linux64.c
gdb/features/s390x-vx-linux64.c
gdb/features/sparc/sparc32-solaris.c
gdb/features/sparc/sparc64-solaris.c
gdb/features/z80.c
gdb/i386-tdep.c
gdb/microblaze-tdep.c
gdb/mips-linux-nat.c
gdb/mips-linux-tdep.h
gdb/nds32-tdep.c
gdb/or1k-tdep.c
gdb/ppc-linux-nat.c
gdb/ppc-tdep.h
gdb/rs6000-aix-nat.c
gdb/rs6000-aix-tdep.c
gdb/rs6000-tdep.c
gdb/rx-tdep.c
gdb/s390-linux-nat.c
gdb/s390-linux-tdep.c
gdb/s390-linux-tdep.h
gdb/s390-tdep.c
gdb/s390-tdep.h
gdb/target-descriptions.c
gdb/z80-tdep.c
gdbserver/linux-aarch32-tdesc.cc
gdbserver/linux-aarch64-tdesc.cc
gdbserver/linux-arc-low.cc
gdbserver/linux-arm-tdesc.cc
gdbserver/linux-ppc-ipa.cc
gdbserver/linux-ppc-low.cc
gdbserver/linux-tic6x-low.cc
gdbserver/netbsd-aarch64-low.cc
gdbserver/netbsd-amd64-low.cc
gdbserver/netbsd-i386-low.cc
gdbserver/tdesc.cc
gdbserver/win32-i386-low.cc
gdbserver/win32-low.cc
gdbserver/win32-low.h
gdbsupport/tdesc.h

index 8f27a4ee49e9012b534c4a683bb810d0867f1119..54e67496a0e24abf053acc45761180038ecdb248 100644 (file)
 #include "gdbsupport/common-regcache.h"
 #include "arch/aarch32.h"
 
-static struct target_desc *tdesc_aarch32_list[2];
+static const_target_desc_up tdesc_aarch32_list[2];
 
 /* See aarch32-tdep.h.  */
 
 const target_desc *
 aarch32_read_description (bool tls)
 {
-  struct target_desc *tdesc = tdesc_aarch32_list[tls];
+  const_target_desc_up &tdesc = tdesc_aarch32_list[tls];
 
   if (tdesc == nullptr)
-    {
-      tdesc = aarch32_create_target_description (tls);
-      tdesc_aarch32_list[tls] = tdesc;
-    }
+    tdesc = aarch32_create_target_description (tls);
 
-  return tdesc;
+  return tdesc.get ();
 }
index db8dff5d03108cb8aaecfa100427a24fb0de7eff..86bfa559ee6788811d52d9075a84227fa177b668 100644 (file)
@@ -54,7 +54,6 @@
 
 #include "opcode/aarch64.h"
 #include <algorithm>
-#include <unordered_map>
 
 /* For inferior_ptid and current_inferior ().  */
 #include "inferior.h"
@@ -66,7 +65,8 @@
 #define HA_MAX_NUM_FLDS                4
 
 /* All possible aarch64 target descriptors.  */
-static gdb::unordered_map <aarch64_features, target_desc *> tdesc_aarch64_map;
+static gdb::unordered_map <aarch64_features, const_target_desc_up>
+  tdesc_aarch64_map;
 
 /* The standard register names, and all the valid aliases for them.
    We're not adding fp here, that name is already taken, see
@@ -4029,15 +4029,12 @@ aarch64_read_description (const aarch64_features &features)
     error (_("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq,
           AARCH64_MAX_SVE_VQ);
 
-  struct target_desc *tdesc = tdesc_aarch64_map[features];
+  const_target_desc_up &tdesc = tdesc_aarch64_map[features];
 
-  if (tdesc == NULL)
-    {
-      tdesc = aarch64_create_target_description (features);
-      tdesc_aarch64_map[features] = tdesc;
-    }
+  if (tdesc == nullptr)
+    tdesc = aarch64_create_target_description (features);
 
-  return tdesc;
+  return tdesc.get ();
 }
 
 /* Return the VQ used when creating the target description TDESC.  */
index 2fd0317d99a3c61ae536b1c48ccbe727fe7f62bc..562450ea779e6f379f764f3cd2411ae9ba3bd5c2 100644 (file)
@@ -1702,7 +1702,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     return arches->gdbarch;
 
   if (tdesc == nullptr)
-    tdesc = tdesc_alpha;
+    tdesc = tdesc_alpha.get ();
 
   /* Validate target description.  */
   if (tdesc_has_registers (tdesc))
index f7224ff76e779a14a1a43ccf93da21ca9b131f1e..63f05d4b4529ddd07fbce3b000e35a621d4fb097 100755 (executable)
@@ -3716,21 +3716,20 @@ amd64_x32_none_init_abi (gdbarch_info info, gdbarch *arch)
 const struct target_desc *
 amd64_target_description (uint64_t xstate_bv, bool segments)
 {
-  static target_desc *amd64_tdescs \
+  static const_target_desc_up amd64_tdescs \
     [2/*AVX*/][2/*AVX512*/][2/*PKRU*/][2/*CET_U*/][2/*segments*/] = {};
-  target_desc **tdesc;
-
-  tdesc = &amd64_tdescs[(xstate_bv & X86_XSTATE_AVX) ? 1 : 0]
-    [(xstate_bv & X86_XSTATE_AVX512) ? 1 : 0]
-    [(xstate_bv & X86_XSTATE_PKRU) ? 1 : 0]
-    [(xstate_bv & X86_XSTATE_CET_U) ? 1 : 0]
-    [segments ? 1 : 0];
-
-  if (*tdesc == NULL)
-    *tdesc = amd64_create_target_description (xstate_bv, false,
-                                             false, segments);
-
-  return *tdesc;
+  const_target_desc_up &tdesc
+    = amd64_tdescs[(xstate_bv & X86_XSTATE_AVX) ? 1 : 0]
+                 [(xstate_bv & X86_XSTATE_AVX512) ? 1 : 0]
+                 [(xstate_bv & X86_XSTATE_PKRU) ? 1 : 0]
+                 [(xstate_bv & X86_XSTATE_CET_U) ? 1 : 0]
+                 [segments ? 1 : 0];
+
+  if (tdesc == nullptr)
+    tdesc = amd64_create_target_description (xstate_bv, false,
+                                            false, segments);
+
+  return tdesc.get ();
 }
 
 #if GDB_SELF_TEST
index 9ae69fd589e261fe9ca5be1aa2c9b68906a91553..489215c6c1cfca94c6b1376b13cedf9640f4d77a 100644 (file)
@@ -23,7 +23,7 @@
 
 /* See aarch32.h.  */
 
-target_desc *
+target_desc_up
 aarch32_create_target_description (bool tls)
 {
   target_desc_up tdesc = allocate_target_description ();
@@ -41,5 +41,5 @@ aarch32_create_target_description (bool tls)
   if (tls)
     regnum = create_feature_arm_arm_tls (tdesc.get (), regnum);
 
-  return tdesc.release ();
+  return tdesc;
 }
index 7dd43f804e68d5a611278f5b1e660bb33cb4e772..eff96673d852470c428957b523e966a1872e9484 100644 (file)
@@ -22,6 +22,6 @@
 
 /* Create the AArch32 target description.  */
 
-target_desc *aarch32_create_target_description (bool tls);
+target_desc_up aarch32_create_target_description (bool tls);
 
 #endif /* GDB_ARCH_AARCH32_H */
index 622138f43b5b367aab8bf714158daadc09539c8d..091b4e2982ccac402802415a532980e548ed156c 100644 (file)
@@ -32,7 +32,7 @@
 
 /* See arch/aarch64.h.  */
 
-target_desc *
+target_desc_up
 aarch64_create_target_description (const aarch64_features &features)
 {
   target_desc_up tdesc = allocate_target_description ();
@@ -77,7 +77,7 @@ aarch64_create_target_description (const aarch64_features &features)
   if (features.fpmr)
     regnum = create_feature_aarch64_fpmr (tdesc.get (), regnum);
 
-  return tdesc.release ();
+  return tdesc;
 }
 
 /* See arch/aarch64.h.  */
index bcbf47dc3a35bb4a70d1b49a27411a0f3431c5dc..16e91c51aad205532d74812b2e60ef0420dce5f5 100644 (file)
@@ -109,7 +109,7 @@ namespace std
 
 /* Create the aarch64 target description.  */
 
-target_desc *
+target_desc_up
   aarch64_create_target_description (const aarch64_features &features);
 
 /* Given a pointer value POINTER and a MASK of non-address bits, remove the
index 4a7f2329f23deae9908e73c7c9b5fe2a31d87d42..eefa3c45b6e6158220c7f3259aaee6939569ac33 100644 (file)
@@ -30,7 +30,7 @@ const struct target_desc *
 amd64_linux_read_description (uint64_t xstate_bv, bool is_x32)
 {
   /* The type used for the amd64 and x32 target description caches.  */
-  using tdesc_cache_type = gdb::unordered_map<uint64_t, target_desc_up>;
+  using tdesc_cache_type = gdb::unordered_map<uint64_t, const_target_desc_up>;
 
   /* Caches for the previously seen amd64 and x32 target descriptions,
      indexed by the xstate_bv value that created the target
@@ -50,19 +50,18 @@ amd64_linux_read_description (uint64_t xstate_bv, bool is_x32)
     ? x86_linux_x32_xstate_bv_feature_mask ()
     : x86_linux_amd64_xstate_bv_feature_mask ();
 
-  const auto it = tdesc_cache.find (xstate_bv);
-  if (it != tdesc_cache.end ())
-    return it->second.get ();
+  const_target_desc_up &tdesc = tdesc_cache[xstate_bv];
+  if (tdesc != nullptr)
+    return tdesc.get ();
 
   /* Create the previously unseen target description.  */
-  target_desc_up tdesc (amd64_create_target_description (xstate_bv, is_x32,
-                                                        true, true));
-  x86_linux_post_init_tdesc (tdesc.get (), true);
+  target_desc_up new_tdesc
+    = amd64_create_target_description (xstate_bv, is_x32, true, true);
+  x86_linux_post_init_tdesc (new_tdesc.get (), true);
 
   /* Add to the cache, and return a pointer borrowed from the
      target_desc_up.  This is safe as the cache (and the pointers contained
      within it) are not deleted until GDB exits.  */
-  target_desc *ptr = tdesc.get ();
-  tdesc_cache.emplace (xstate_bv, std::move (tdesc));
-  return ptr;
+  tdesc = std::move (new_tdesc);
+  return tdesc.get ();
 }
index 9fbe80266005801c6951ef7506e3cdd69d98d0b3..01a0de2d5f3b34f81cb0dd4b483679cb5b1f600d 100644 (file)
@@ -34,7 +34,7 @@
 
 /* See arch/amd64.h.  */
 
-target_desc *
+target_desc_up
 amd64_create_target_description (uint64_t xstate_bv, bool is_x32,
                                 bool is_linux, bool segments)
 {
@@ -78,5 +78,5 @@ amd64_create_target_description (uint64_t xstate_bv, bool is_x32,
        regnum = create_feature_i386_32bit_ssp (tdesc.get (), regnum);
     }
 
-  return tdesc.release ();
+  return tdesc;
 }
index 60c17ebc42db110334eb50e0057a482bfe0ece4f..1782d39cc5901e907ef1868228775ad52c79d30c 100644 (file)
@@ -26,8 +26,8 @@
    target descriptions for Linux.  If SEGMENTS is true, then include
    the "org.gnu.gdb.i386.segments" feature registers.  */
 
-target_desc *amd64_create_target_description (uint64_t xstate_bv,
-                                             bool is_x32, bool is_linux,
-                                             bool segments);
+target_desc_up amd64_create_target_description (uint64_t xstate_bv,
+                                               bool is_x32, bool is_linux,
+                                               bool segments);
 
 #endif /* GDB_ARCH_AMD64_H */
index 1843dbee61285ea52f8633f1406423fa57fda8fe..36241f70f8f27e5e424901764c925b796dd5ad44 100644 (file)
@@ -373,7 +373,7 @@ shifted_reg_val (reg_buffer_common *regcache, unsigned long inst,
 
 /* See arch/arm.h.  */
 
-target_desc *
+target_desc_up
 arm_create_target_description (arm_fp_type fp_type, bool tls)
 {
   target_desc_up tdesc = allocate_target_description ();
@@ -413,18 +413,18 @@ arm_create_target_description (arm_fp_type fp_type, bool tls)
   if (tls)
     regnum = create_feature_arm_arm_tls (tdesc.get (), regnum);
 
-  return tdesc.release ();
+  return tdesc;
 }
 
 /* See arch/arm.h.  */
 
-target_desc *
+target_desc_up
 arm_create_mprofile_target_description (arm_m_profile_type m_type)
 {
-  target_desc *tdesc = allocate_target_description ().release ();
+  target_desc_up tdesc = allocate_target_description ();
 
 #ifndef IN_PROCESS_AGENT
-  set_tdesc_architecture (tdesc, "arm");
+  set_tdesc_architecture (tdesc.get (), "arm");
 #endif
 
   long regnum = 0;
@@ -432,27 +432,27 @@ arm_create_mprofile_target_description (arm_m_profile_type m_type)
   switch (m_type)
     {
     case ARM_M_TYPE_M_PROFILE:
-      regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
+      regnum = create_feature_arm_arm_m_profile (tdesc.get (), regnum);
       break;
 
     case ARM_M_TYPE_VFP_D16:
-      regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
-      regnum = create_feature_arm_arm_vfpv2 (tdesc, regnum);
+      regnum = create_feature_arm_arm_m_profile (tdesc.get (), regnum);
+      regnum = create_feature_arm_arm_vfpv2 (tdesc.get (), regnum);
       break;
 
     case ARM_M_TYPE_WITH_FPA:
-      regnum = create_feature_arm_arm_m_profile_with_fpa (tdesc, regnum);
+      regnum = create_feature_arm_arm_m_profile_with_fpa (tdesc.get (), regnum);
       break;
 
     case ARM_M_TYPE_MVE:
-      regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
-      regnum = create_feature_arm_arm_vfpv2 (tdesc, regnum);
-      regnum = create_feature_arm_arm_m_profile_mve (tdesc, regnum);
+      regnum = create_feature_arm_arm_m_profile (tdesc.get (), regnum);
+      regnum = create_feature_arm_arm_vfpv2 (tdesc.get (), regnum);
+      regnum = create_feature_arm_arm_m_profile_mve (tdesc.get (), regnum);
       break;
 
     case ARM_M_TYPE_SYSTEM:
-      regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
-      regnum = create_feature_arm_arm_m_system (tdesc, regnum);
+      regnum = create_feature_arm_arm_m_profile (tdesc.get (), regnum);
+      regnum = create_feature_arm_arm_m_system (tdesc.get (), regnum);
       break;
 
     default:
index d9c750329a48799f9ae231279eda162280ca8d4c..3e99e1bf6af894c84c4ff848406aff597c04487c 100644 (file)
@@ -238,10 +238,11 @@ unsigned long shifted_reg_val (reg_buffer_common *regcache,
 
 /* Create an Arm target description with the given FP hardware type.  */
 
-target_desc *arm_create_target_description (arm_fp_type fp_type, bool tls);
+target_desc_up arm_create_target_description (arm_fp_type fp_type, bool tls);
 
 /* Create an Arm M-profile target description with the given hardware type.  */
 
-target_desc *arm_create_mprofile_target_description (arm_m_profile_type m_type);
+target_desc_up arm_create_mprofile_target_description
+  (arm_m_profile_type m_type);
 
 #endif /* GDB_ARCH_ARM_H */
index 74f192b9c37c08cac64a5d1231a694152be6452a..c3ee3028785a28ae2428c521664eccae02ada627 100644 (file)
@@ -32,7 +32,7 @@ i386_linux_read_description (uint64_t xstate_bv)
      xstate_bv value that created the target description.  This
      needs to be static within this function to ensure it is initialised
      before first use.  */
-  static gdb::unordered_map<uint64_t, target_desc_up> i386_tdesc_cache;
+  static gdb::unordered_map<uint64_t, const_target_desc_up> i386_tdesc_cache;
 
   /* Only some bits are checked when creating a tdesc, but the
      XSTATE_BV value contains other feature bits that are not relevant
@@ -42,19 +42,18 @@ i386_linux_read_description (uint64_t xstate_bv)
      set.  */
   xstate_bv &= x86_linux_i386_xstate_bv_feature_mask ();
 
-  const auto it = i386_tdesc_cache.find (xstate_bv);
-  if (it != i386_tdesc_cache.end ())
-    return it->second.get ();
+  const_target_desc_up &tdesc = i386_tdesc_cache[xstate_bv];
+  if (tdesc != nullptr)
+    return tdesc.get ();
 
   /* Create the previously unseen target description.  */
-  target_desc_up tdesc
-    (i386_create_target_description (xstate_bv, true, false));
-  x86_linux_post_init_tdesc (tdesc.get (), false);
+  target_desc_up new_tdesc
+    = i386_create_target_description (xstate_bv, true, false);
+  x86_linux_post_init_tdesc (new_tdesc.get (), false);
 
   /* Add to the cache, and return a pointer borrowed from the
      target_desc_up.  This is safe as the cache (and the pointers contained
      within it) are not deleted until GDB exits.  */
-  target_desc *ptr = tdesc.get ();
-  i386_tdesc_cache.emplace (xstate_bv, std::move (tdesc));
-  return ptr;
+  tdesc = std::move (new_tdesc);
+  return tdesc.get ();
 }
index 4ec4f10311187ae3fa6a2a1e58a645a2a79d2bfd..88aa22323f6f09ccba590c29fc87bf2ec1ef395c 100644 (file)
@@ -32,7 +32,7 @@
 
 /* See arch/i386.h.  */
 
-target_desc *
+target_desc_up
 i386_create_target_description (uint64_t xstate_bv, bool is_linux,
                                bool segments)
 {
@@ -70,5 +70,5 @@ i386_create_target_description (uint64_t xstate_bv, bool is_linux,
   if (xstate_bv & X86_XSTATE_CET_U)
     regnum = create_feature_i386_32bit_ssp (tdesc.get (), regnum);
 
-  return tdesc.release ();
+  return tdesc;
 }
index 91a581f83ee9a7ef2e3bfab564d5b67239026887..145ed151acd0e890067927fd23fae8efca1117c7 100644 (file)
@@ -25,8 +25,7 @@
    true, create target descriptions for Linux.  If SEGMENTS is true, then
    include the "org.gnu.gdb.i386.segments" feature registers.  */
 
-target_desc *i386_create_target_description (uint64_t xstate_bv,
-                                            bool is_linux,
-                                            bool segments);
+target_desc_up i386_create_target_description (uint64_t xstate_bv,
+                                              bool is_linux, bool segments);
 
 #endif /* GDB_ARCH_I386_H */
index 25e698d9fcef18906785e008ef42f73a3cd27827..395c3db0614b491c49140b95aee5c6d42366cf11 100644 (file)
@@ -89,7 +89,7 @@ struct loongarch_gdbarch_features_hasher
 /* Cache of previously seen target descriptions, indexed by the feature set
    that created them.  */
 static std::unordered_map<loongarch_gdbarch_features,
-                         const target_desc_up,
+                         const_target_desc_up,
                          loongarch_gdbarch_features_hasher> loongarch_tdesc_cache;
 
 const target_desc *
@@ -98,18 +98,11 @@ loongarch_lookup_target_description (const struct loongarch_gdbarch_features fea
   /* Lookup in the cache.  If we find it then return the pointer out of
      the target_desc_up (which is a unique_ptr).  This is safe as the
      loongarch_tdesc_cache will exist until GDB exits.  */
-  const auto it = loongarch_tdesc_cache.find (features);
-  if (it != loongarch_tdesc_cache.end ())
-    return it->second.get ();
-
-  target_desc_up tdesc (loongarch_create_target_description (features));
-
-  /* Add to the cache, and return a pointer borrowed from the
-     target_desc_up.  This is safe as the cache (and the pointers
-     contained within it) are not deleted until GDB exits.  */
-  target_desc *ptr = tdesc.get ();
-  loongarch_tdesc_cache.emplace (features, std::move (tdesc));
-  return ptr;
+  const_target_desc_up &tdesc = loongarch_tdesc_cache[features];
+  if (tdesc == nullptr)
+    tdesc = loongarch_create_target_description (features);
+
+  return tdesc.get ();
 }
 
 #endif /* !GDBSERVER */
index 2088b7656b191df2accc3b559ae604448c5548b7..40c54c191a62af0e70f9567376999f1ade7c1bd5 100644 (file)
@@ -50,34 +50,34 @@ ppc_linux_match_description (struct ppc_linux_features features)
   if (features.wordsize == 8)
     {
       if (features.vsx)
-       tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx64l
-                : features.isa207? tdesc_powerpc_isa207_vsx64l
-                : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l
-                : features.isa205? tdesc_powerpc_isa205_vsx64l
-                : tdesc_powerpc_vsx64l);
+       tdesc = (features.htm ? tdesc_powerpc_isa207_htm_vsx64l
+                : features.isa207 ? tdesc_powerpc_isa207_vsx64l
+                : features.ppr_dscr ? tdesc_powerpc_isa205_ppr_dscr_vsx64l
+                : features.isa205 ? tdesc_powerpc_isa205_vsx64l
+                : tdesc_powerpc_vsx64l).get ();
       else if (features.altivec)
-       tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l
-                : tdesc_powerpc_altivec64l);
+       tdesc = (features.isa205 ? tdesc_powerpc_isa205_altivec64l
+                : tdesc_powerpc_altivec64l).get ();
       else
-       tdesc = (features.isa205? tdesc_powerpc_isa205_64l
-                : tdesc_powerpc_64l);
+       tdesc = (features.isa205 ? tdesc_powerpc_isa205_64l
+                : tdesc_powerpc_64l).get ();
     }
   else
     {
       gdb_assert (features.wordsize == 4);
 
       if (features.vsx)
-       tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx32l
-                : features.isa207? tdesc_powerpc_isa207_vsx32l
-                : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l
-                : features.isa205? tdesc_powerpc_isa205_vsx32l
-                : tdesc_powerpc_vsx32l);
+       tdesc = (features.htm ? tdesc_powerpc_isa207_htm_vsx32l
+                : features.isa207 ? tdesc_powerpc_isa207_vsx32l
+                : features.ppr_dscr ? tdesc_powerpc_isa205_ppr_dscr_vsx32l
+                : features.isa205 ? tdesc_powerpc_isa205_vsx32l
+                : tdesc_powerpc_vsx32l).get ();
       else if (features.altivec)
-       tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l
-                : tdesc_powerpc_altivec32l);
+       tdesc = (features.isa205 ? tdesc_powerpc_isa205_altivec32l
+                : tdesc_powerpc_altivec32l).get ();
       else
-       tdesc = (features.isa205? tdesc_powerpc_isa205_32l
-                : tdesc_powerpc_32l);
+       tdesc = (features.isa205 ? tdesc_powerpc_isa205_32l
+                : tdesc_powerpc_32l).get ();
     }
 
   gdb_assert (tdesc != NULL);
index 1ff316ad826184ca603bce5186ac2a101450e2e1..fbed67a79902cf2f901342227d5d7831a563cd82 100644 (file)
 #ifndef GDB_ARCH_PPC_LINUX_TDESC_H
 #define GDB_ARCH_PPC_LINUX_TDESC_H
 
+#include "gdbsupport/tdesc.h"
+
 struct target_desc;
 
-extern const struct target_desc *tdesc_powerpc_32l;
-extern const struct target_desc *tdesc_powerpc_altivec32l;
-extern const struct target_desc *tdesc_powerpc_vsx32l;
-extern const struct target_desc *tdesc_powerpc_isa205_32l;
-extern const struct target_desc *tdesc_powerpc_isa205_altivec32l;
-extern const struct target_desc *tdesc_powerpc_isa205_vsx32l;
-extern const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
-extern const struct target_desc *tdesc_powerpc_isa207_vsx32l;
-extern const struct target_desc *tdesc_powerpc_isa207_htm_vsx32l;
-extern const struct target_desc *tdesc_powerpc_e500l;
-
-extern const struct target_desc *tdesc_powerpc_64l;
-extern const struct target_desc *tdesc_powerpc_altivec64l;
-extern const struct target_desc *tdesc_powerpc_vsx64l;
-extern const struct target_desc *tdesc_powerpc_isa205_64l;
-extern const struct target_desc *tdesc_powerpc_isa205_altivec64l;
-extern const struct target_desc *tdesc_powerpc_isa205_vsx64l;
-extern const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
-extern const struct target_desc *tdesc_powerpc_isa207_vsx64l;
-extern const struct target_desc *tdesc_powerpc_isa207_htm_vsx64l;
+extern const_target_desc_up tdesc_powerpc_32l;
+extern const_target_desc_up tdesc_powerpc_altivec32l;
+extern const_target_desc_up tdesc_powerpc_vsx32l;
+extern const_target_desc_up tdesc_powerpc_isa205_32l;
+extern const_target_desc_up tdesc_powerpc_isa205_altivec32l;
+extern const_target_desc_up tdesc_powerpc_isa205_vsx32l;
+extern const_target_desc_up tdesc_powerpc_isa205_ppr_dscr_vsx32l;
+extern const_target_desc_up tdesc_powerpc_isa207_vsx32l;
+extern const_target_desc_up tdesc_powerpc_isa207_htm_vsx32l;
+extern const_target_desc_up tdesc_powerpc_e500l;
+
+extern const_target_desc_up tdesc_powerpc_64l;
+extern const_target_desc_up tdesc_powerpc_altivec64l;
+extern const_target_desc_up tdesc_powerpc_vsx64l;
+extern const_target_desc_up tdesc_powerpc_isa205_64l;
+extern const_target_desc_up tdesc_powerpc_isa205_altivec64l;
+extern const_target_desc_up tdesc_powerpc_isa205_vsx64l;
+extern const_target_desc_up tdesc_powerpc_isa205_ppr_dscr_vsx64l;
+extern const_target_desc_up tdesc_powerpc_isa207_vsx64l;
+extern const_target_desc_up tdesc_powerpc_isa207_htm_vsx64l;
 
 #endif /* GDB_ARCH_PPC_LINUX_TDESC_H */
index 5724305160876de9916e1a41ee45a371659799c0..ecfbd559f2ba9760543bada9b0e8d2ddb011585d 100644 (file)
@@ -25,7 +25,7 @@
 
 /* Create tic6x target descriptions according to FEATURE.  */
 
-target_desc *
+target_desc_up
 tic6x_create_target_description (enum c6x_feature feature)
 {
   target_desc_up tdesc = allocate_target_description ();
@@ -43,5 +43,5 @@ tic6x_create_target_description (enum c6x_feature feature)
   if (feature == C6X_C6XP)
     regnum = create_feature_tic6x_c6xp (tdesc.get (), regnum);
 
-  return tdesc.release ();
+  return tdesc;
 }
index 6120892113e949d659a13a609503893315f1214a..30950e740b2f19d43b65d57bf2b3b8e91cb97b02 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef GDB_ARCH_TIC6X_H
 #define GDB_ARCH_TIC6X_H
 
+#include "gdbsupport/tdesc.h"
+
 enum c6x_feature
 {
   C6X_CORE,
@@ -26,6 +28,6 @@ enum c6x_feature
   C6X_LAST,
 };
 
-target_desc *tic6x_create_target_description (enum c6x_feature feature);
+target_desc_up tic6x_create_target_description (c6x_feature feature);
 
 #endif /* GDB_ARCH_TIC6X_H */
index 8845ef27acc8a674e2ad8e7639dfd4f5c09c8d42..eef985bb27659a23a42b06cd3f92611c0637b1ea 100644 (file)
@@ -240,8 +240,8 @@ static const char **valid_disassembly_styles;
 static const char *disassembly_style;
 
 /* All possible arm target descriptors.  */
-static struct target_desc *tdesc_arm_list[ARM_FP_TYPE_INVALID][2];
-static struct target_desc *tdesc_arm_mprofile_list[ARM_M_TYPE_INVALID];
+static const_target_desc_up tdesc_arm_list[ARM_FP_TYPE_INVALID][2];
+static const_target_desc_up tdesc_arm_mprofile_list[ARM_M_TYPE_INVALID];
 
 /* This is used to keep the bfd arch_info in sync with the disassembly
    style.  */
@@ -14961,15 +14961,12 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
 const target_desc *
 arm_read_description (arm_fp_type fp_type, bool tls)
 {
-  struct target_desc *tdesc = tdesc_arm_list[fp_type][tls];
+  const_target_desc_up &tdesc = tdesc_arm_list[fp_type][tls];
 
   if (tdesc == nullptr)
-    {
-      tdesc = arm_create_target_description (fp_type, tls);
-      tdesc_arm_list[fp_type][tls] = tdesc;
-    }
+    tdesc = arm_create_target_description (fp_type, tls);
 
-  return tdesc;
+  return tdesc.get ();
 }
 
 /* See arm-tdep.h.  */
@@ -14977,13 +14974,10 @@ arm_read_description (arm_fp_type fp_type, bool tls)
 const target_desc *
 arm_read_mprofile_description (arm_m_profile_type m_type)
 {
-  struct target_desc *tdesc = tdesc_arm_mprofile_list[m_type];
+  const_target_desc_up &tdesc = tdesc_arm_mprofile_list[m_type];
 
   if (tdesc == nullptr)
-    {
-      tdesc = arm_create_mprofile_target_description (m_type);
-      tdesc_arm_mprofile_list[m_type] = tdesc;
-    }
+    tdesc = arm_create_mprofile_target_description (m_type);
 
-  return tdesc;
+  return tdesc.get ();
 }
index 35f12fcbd4c2356c74f7e0287cb83b897a7d3ae3..73d3fdf6804d32619f10e119cd0fa48bf4036cd3 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_alpha;
+const_target_desc_up tdesc_alpha;
 static void
 initialize_tdesc_alpha (void)
 {
@@ -107,5 +107,5 @@ initialize_tdesc_alpha (void)
   tdesc_create_reg (feature, "", 65, 0, NULL, 64, "int64");
   tdesc_create_reg (feature, "unique", 66, 1, "system", 64, "int64");
 
-  tdesc_alpha = result.release ();
+  tdesc_alpha = std::move (result);
 }
index 087865cd41cbe2b371ea9cbba852d301e8924e8d..9f9fae38b5c9308121d7e1872d6206f8d81b7075 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_microblaze_linux;
+const_target_desc_up tdesc_microblaze_linux;
 static void
 initialize_tdesc_microblaze_linux (void)
 {
@@ -74,5 +74,5 @@ initialize_tdesc_microblaze_linux (void)
   tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
 
-  tdesc_microblaze_linux = result.release ();
+  tdesc_microblaze_linux = std::move (result);
 }
index e5c0956610a375a929410c132e0e35f76a6e8c0e..a3e75d123a244f1075aa221580778899d7f5e835 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_microblaze_with_stack_protect;
+const_target_desc_up tdesc_microblaze_with_stack_protect;
 static void
 initialize_tdesc_microblaze_with_stack_protect (void)
 {
@@ -74,5 +74,5 @@ initialize_tdesc_microblaze_with_stack_protect (void)
   tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
 
-  tdesc_microblaze_with_stack_protect = result.release ();
+  tdesc_microblaze_with_stack_protect = std::move (result);
 }
index 32ae3b02ad766be3a05571a3c4960364b743a68e..fe367f3b82f73720be2728f0c67a511b5ff02ba7 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_microblaze;
+const_target_desc_up tdesc_microblaze;
 static void
 initialize_tdesc_microblaze (void)
 {
@@ -70,5 +70,5 @@ initialize_tdesc_microblaze (void)
   tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
 
-  tdesc_microblaze = result.release ();
+  tdesc_microblaze = std::move (result);
 }
index 4873037b69d3e41debbea5e63f12aac559454b34..62771b72b94935af06a278a6cc9c0c6bdd3fbd2d 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_mips_dsp_linux;
+const_target_desc_up tdesc_mips_dsp_linux;
 static void
 initialize_tdesc_mips_dsp_linux (void)
 {
@@ -105,5 +105,5 @@ initialize_tdesc_mips_dsp_linux (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.mips.linux");
   tdesc_create_reg (feature, "restart", 79, 1, "system", 32, "int");
 
-  tdesc_mips_dsp_linux = result.release ();
+  tdesc_mips_dsp_linux = std::move (result);
 }
index 5ff2e5fb92d76e2da2194b258bfc0eee1859d5b4..ae668ae6ac981c904737975dd2e8847eb2db1b8c 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_mips_linux;
+const_target_desc_up tdesc_mips_linux;
 static void
 initialize_tdesc_mips_linux (void)
 {
@@ -96,5 +96,5 @@ initialize_tdesc_mips_linux (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.mips.linux");
   tdesc_create_reg (feature, "restart", 72, 1, "system", 32, "int");
 
-  tdesc_mips_linux = result.release ();
+  tdesc_mips_linux = std::move (result);
 }
index 646f5487f49cdaa42ddf1c3e7ffdc8c51fa677bc..f186394ebb9b890bad993ce74a7531896b842939 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_mips64_dsp_linux;
+const_target_desc_up tdesc_mips64_dsp_linux;
 static void
 initialize_tdesc_mips64_dsp_linux (void)
 {
@@ -105,5 +105,5 @@ initialize_tdesc_mips64_dsp_linux (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.mips.linux");
   tdesc_create_reg (feature, "restart", 79, 1, "system", 64, "int");
 
-  tdesc_mips64_dsp_linux = result.release ();
+  tdesc_mips64_dsp_linux = std::move (result);
 }
index 98b3d34448de757d7cdd1a4b3393bb27314240e5..168b8d83477551040bdb08673d3392ba35ef7ada 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_mips64_linux;
+const_target_desc_up tdesc_mips64_linux;
 static void
 initialize_tdesc_mips64_linux (void)
 {
@@ -96,5 +96,5 @@ initialize_tdesc_mips64_linux (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.mips.linux");
   tdesc_create_reg (feature, "restart", 72, 1, "system", 64, "int");
 
-  tdesc_mips64_linux = result.release ();
+  tdesc_mips64_linux = std::move (result);
 }
index e5c5d50dce1049849a9aa8ab38e968118a859c06..46e86ef0ed2ff3c1867057e4f249887c9620d4b1 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_nds32;
+const_target_desc_up tdesc_nds32;
 static void
 initialize_tdesc_nds32 (void)
 {
@@ -87,5 +87,5 @@ initialize_tdesc_nds32 (void)
   tdesc_create_reg (feature, "itb", 66, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "ifc_lp", 67, 1, NULL, 32, "int");
 
-  tdesc_nds32 = result.release ();
+  tdesc_nds32 = std::move (result);
 }
index 85a681f89ba0d3c1343d7245794aa16d1dcdca31..51e8412cd5cdee21bfe44cf886702b4f42e1cfb4 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_or1k_linux;
+const_target_desc_up tdesc_or1k_linux;
 static void
 initialize_tdesc_or1k_linux (void)
 {
@@ -73,5 +73,5 @@ initialize_tdesc_or1k_linux (void)
   tdesc_create_reg (feature, "npc", 33, 1, NULL, 32, "code_ptr");
   tdesc_create_reg (feature, "sr", 34, 1, NULL, 32, "sr_flags");
 
-  tdesc_or1k_linux = result.release ();
+  tdesc_or1k_linux = std::move (result);
 }
index ee5e2f5b20673b475c7598542c716464382c2c7f..2a62e72837cfcbc42e5d8b1905a3649be9cc48a8 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_or1k;
+const_target_desc_up tdesc_or1k;
 static void
 initialize_tdesc_or1k (void)
 {
@@ -71,5 +71,5 @@ initialize_tdesc_or1k (void)
   tdesc_create_reg (feature, "npc", 33, 1, NULL, 32, "code_ptr");
   tdesc_create_reg (feature, "sr", 34, 1, NULL, 32, "sr_flags");
 
-  tdesc_or1k = result.release ();
+  tdesc_or1k = std::move (result);
 }
index 562761e69a55a59f4472b7fea4ec97b0a25c2572..9fc7e572e2ff4f1e82128d84440f9ac3db58afb4 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_32;
+const_target_desc_up tdesc_powerpc_32;
 static void
 initialize_tdesc_powerpc_32 (void)
 {
@@ -88,5 +88,5 @@ initialize_tdesc_powerpc_32 (void)
   tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double");
   tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int");
 
-  tdesc_powerpc_32 = result.release ();
+  tdesc_powerpc_32 = std::move (result);
 }
index caf81b760171a98ab4fa8683e669ae643711f5c0..5e734af9f8d46e45e23ef7c9b7be2236e33dbf47 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_32l;
+const_target_desc_up tdesc_powerpc_32l;
 static void
 initialize_tdesc_powerpc_32l (void)
 {
@@ -92,5 +92,5 @@ initialize_tdesc_powerpc_32l (void)
   tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int");
 
-  tdesc_powerpc_32l = result.release ();
+  tdesc_powerpc_32l = std::move (result);
 }
index 7cff21ceed7b2cf0172c437998ccb8d37df09a8f..23c863669e965396234897d960379f05ed8311a4 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_403;
+const_target_desc_up tdesc_powerpc_403;
 static void
 initialize_tdesc_powerpc_403 (void)
 {
@@ -162,5 +162,5 @@ initialize_tdesc_powerpc_403 (void)
   tdesc_create_reg (feature, "pbl2", 141, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "pbu2", 142, 1, NULL, 32, "int");
 
-  tdesc_powerpc_403 = result.release ();
+  tdesc_powerpc_403 = std::move (result);
 }
index e86b51c434675d6c4edd1b7d50ff6e8330efb405..6bba1400997eadf92a43509d8c4c2854104f9d72 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_403gc;
+const_target_desc_up tdesc_powerpc_403gc;
 static void
 initialize_tdesc_powerpc_403gc (void)
 {
@@ -168,5 +168,5 @@ initialize_tdesc_powerpc_403gc (void)
   tdesc_create_reg (feature, "tbhu", 147, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "tblu", 148, 1, NULL, 32, "int");
 
-  tdesc_powerpc_403gc = result.release ();
+  tdesc_powerpc_403gc = std::move (result);
 }
index 2716e37d8a8c992d8cd10a1c409306d01771ff0e..c55a4bcf12bb56d197acfb89522b50c6abdbc463 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_405;
+const_target_desc_up tdesc_powerpc_405;
 static void
 initialize_tdesc_powerpc_405 (void)
 {
@@ -131,5 +131,5 @@ initialize_tdesc_powerpc_405 (void)
   tdesc_create_reg (feature, "su0r", 160, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "usprg0", 161, 1, NULL, 32, "int");
 
-  tdesc_powerpc_405 = result.release ();
+  tdesc_powerpc_405 = std::move (result);
 }
index 51352e78bac4557e7fcf6715c1616b79afdc1f77..e36043d51b0f7476cceef258616105da5b05908d 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_505;
+const_target_desc_up tdesc_powerpc_505;
 static void
 initialize_tdesc_powerpc_505 (void)
 {
@@ -141,5 +141,5 @@ initialize_tdesc_powerpc_505 (void)
   tdesc_create_reg (feature, "eid", 120, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "nri", 121, 1, NULL, 32, "int");
 
-  tdesc_powerpc_505 = result.release ();
+  tdesc_powerpc_505 = std::move (result);
 }
index 2b700bbe128fc8e601900dd01b49de21bbad6163..6cc502dc6869c51b10005a4d2d9795ddfbc7f547 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_601;
+const_target_desc_up tdesc_powerpc_601;
 static void
 initialize_tdesc_powerpc_601 (void)
 {
@@ -145,5 +145,5 @@ initialize_tdesc_powerpc_601 (void)
   tdesc_create_reg (feature, "rtcu", 125, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "rtcl", 126, 1, NULL, 32, "int");
 
-  tdesc_powerpc_601 = result.release ();
+  tdesc_powerpc_601 = std::move (result);
 }
index 13591b953020f58bbb0e8457e05a2de9400536c3..6f9344115d871bbce26e0bf8292b15e843a306a9 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_602;
+const_target_desc_up tdesc_powerpc_602;
 static void
 initialize_tdesc_powerpc_602 (void)
 {
@@ -148,5 +148,5 @@ initialize_tdesc_powerpc_602 (void)
   tdesc_create_reg (feature, "sp", 129, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "lt", 130, 1, NULL, 32, "int");
 
-  tdesc_powerpc_602 = result.release ();
+  tdesc_powerpc_602 = std::move (result);
 }
index 88b2b2c98c628a5aaa05c89279bb2fdf3d50ee6d..01f46bfff614106f5db67d99e9c968f0d747ebca 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_603;
+const_target_desc_up tdesc_powerpc_603;
 static void
 initialize_tdesc_powerpc_603 (void)
 {
@@ -148,5 +148,5 @@ initialize_tdesc_powerpc_603 (void)
   tdesc_create_reg (feature, "icmp", 129, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "rpa", 130, 1, NULL, 32, "int");
 
-  tdesc_powerpc_603 = result.release ();
+  tdesc_powerpc_603 = std::move (result);
 }
index d266ba6ee8978fe1688755e87e24267f7facab1d..0f332bcc1635cdcafd26a56d55d0e1f9cfbfb8a6 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_604;
+const_target_desc_up tdesc_powerpc_604;
 static void
 initialize_tdesc_powerpc_604 (void)
 {
@@ -147,5 +147,5 @@ initialize_tdesc_powerpc_604 (void)
   tdesc_create_reg (feature, "sia", 126, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "sda", 127, 1, NULL, 32, "int");
 
-  tdesc_powerpc_604 = result.release ();
+  tdesc_powerpc_604 = std::move (result);
 }
index c2f741091850bf78f29b36c35a77091349e2859b..03f8195a6ae013fbcc2b41825a501e3ac7ff8114 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_64;
+const_target_desc_up tdesc_powerpc_64;
 static void
 initialize_tdesc_powerpc_64 (void)
 {
@@ -88,5 +88,5 @@ initialize_tdesc_powerpc_64 (void)
   tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double");
   tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int");
 
-  tdesc_powerpc_64 = result.release ();
+  tdesc_powerpc_64 = std::move (result);
 }
index dbe06acdb200d5c260d88efdab2fb4dd80a2ea41..3b863e62e3b995332a9107b3f0e39226af03fa85 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_64l;
+const_target_desc_up tdesc_powerpc_64l;
 static void
 initialize_tdesc_powerpc_64l (void)
 {
@@ -92,5 +92,5 @@ initialize_tdesc_powerpc_64l (void)
   tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 64, "int");
   tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int");
 
-  tdesc_powerpc_64l = result.release ();
+  tdesc_powerpc_64l = std::move (result);
 }
index f1f52eb51e63b6c9cd03089ee61a0d9ebe135663..6fdd2ef363e825fa5635e09a8398e1460e6c77dd 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_7400;
+const_target_desc_up tdesc_powerpc_7400;
 static void
 initialize_tdesc_powerpc_7400 (void)
 {
@@ -199,5 +199,5 @@ initialize_tdesc_powerpc_7400 (void)
   tdesc_create_reg (feature, "vscr", 151, 1, "vector", 32, "int");
   tdesc_create_reg (feature, "vrsave", 152, 1, "vector", 32, "int");
 
-  tdesc_powerpc_7400 = result.release ();
+  tdesc_powerpc_7400 = std::move (result);
 }
index 14f4905659064c2ffe62f0f4694704f0cf6e235f..fc61ad552f4efd0e8939888de20c36b0c38ec6b2 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_750;
+const_target_desc_up tdesc_powerpc_750;
 static void
 initialize_tdesc_powerpc_750 (void)
 {
@@ -160,5 +160,5 @@ initialize_tdesc_powerpc_750 (void)
   tdesc_create_reg (feature, "thrm2", 141, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "thrm3", 142, 1, NULL, 32, "int");
 
-  tdesc_powerpc_750 = result.release ();
+  tdesc_powerpc_750 = std::move (result);
 }
index b02fcc4e357ea5aaede0551e5c4de2d45562acce..5cb55107150ca47e16ad4e62d719029bd1620195 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_860;
+const_target_desc_up tdesc_powerpc_860;
 static void
 initialize_tdesc_powerpc_860 (void)
 {
@@ -185,5 +185,5 @@ initialize_tdesc_powerpc_860 (void)
   tdesc_create_reg (feature, "md_dbram0", 164, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "md_dbram1", 165, 1, NULL, 32, "int");
 
-  tdesc_powerpc_860 = result.release ();
+  tdesc_powerpc_860 = std::move (result);
 }
index 05f7348df9acda2bf14dc169d9c4e98e3605ce5f..d683591e8c49e2702d8904076d2a12ec7456b525 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_altivec32;
+const_target_desc_up tdesc_powerpc_altivec32;
 static void
 initialize_tdesc_powerpc_altivec32 (void)
 {
@@ -151,5 +151,5 @@ initialize_tdesc_powerpc_altivec32 (void)
   tdesc_create_reg (feature, "vscr", 103, 1, "vector", 32, "int");
   tdesc_create_reg (feature, "vrsave", 104, 1, "vector", 32, "int");
 
-  tdesc_powerpc_altivec32 = result.release ();
+  tdesc_powerpc_altivec32 = std::move (result);
 }
index 0bcae972502e45c682845fda230b07c8abdb3d8b..3670597daae3c5467e11ee80a80378ad56b8a125 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_altivec32l;
+const_target_desc_up tdesc_powerpc_altivec32l;
 static void
 initialize_tdesc_powerpc_altivec32l (void)
 {
@@ -155,5 +155,5 @@ initialize_tdesc_powerpc_altivec32l (void)
   tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int");
   tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
 
-  tdesc_powerpc_altivec32l = result.release ();
+  tdesc_powerpc_altivec32l = std::move (result);
 }
index bdc50004391820a0ad61e8ece4f485b46309fc92..4f720b774d8c0825889b6a2a9d35092d6cd2e076 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_altivec64;
+const_target_desc_up tdesc_powerpc_altivec64;
 static void
 initialize_tdesc_powerpc_altivec64 (void)
 {
@@ -151,5 +151,5 @@ initialize_tdesc_powerpc_altivec64 (void)
   tdesc_create_reg (feature, "vscr", 103, 1, "vector", 32, "int");
   tdesc_create_reg (feature, "vrsave", 104, 1, "vector", 32, "int");
 
-  tdesc_powerpc_altivec64 = result.release ();
+  tdesc_powerpc_altivec64 = std::move (result);
 }
index 2392f3496576cf8d19cbe06e00ffa2b82ba485b5..9df0d53c4f914eb0c37a008cf20dd7c168ffb770 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_altivec64l;
+const_target_desc_up tdesc_powerpc_altivec64l;
 static void
 initialize_tdesc_powerpc_altivec64l (void)
 {
@@ -155,5 +155,5 @@ initialize_tdesc_powerpc_altivec64l (void)
   tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int");
   tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
 
-  tdesc_powerpc_altivec64l = result.release ();
+  tdesc_powerpc_altivec64l = std::move (result);
 }
index 0442569c318166a444bc42f1cead9fc5655e8cd3..81be763087e543bd3b6eb3696f77e9dbc17a7118 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_e500;
+const_target_desc_up tdesc_powerpc_e500;
 static void
 initialize_tdesc_powerpc_e500 (void)
 {
@@ -89,5 +89,5 @@ initialize_tdesc_powerpc_e500 (void)
   tdesc_create_reg (feature, "acc", 73, 1, NULL, 64, "int");
   tdesc_create_reg (feature, "spefscr", 74, 1, NULL, 32, "int");
 
-  tdesc_powerpc_e500 = result.release ();
+  tdesc_powerpc_e500 = std::move (result);
 }
index 4e426c3005ae03853200df478388c300ac4fd904..7803ff76f137ba11199e6b34a8ccef12eb4fc4bc 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_e500l;
+const_target_desc_up tdesc_powerpc_e500l;
 static void
 initialize_tdesc_powerpc_e500l (void)
 {
@@ -93,5 +93,5 @@ initialize_tdesc_powerpc_e500l (void)
   tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int");
 
-  tdesc_powerpc_e500l = result.release ();
+  tdesc_powerpc_e500l = std::move (result);
 }
index 3834c9800191b4e23464a6175ed5a18596d69b63..a6f2b900dc57bcdbba8a5c8c9495c5938a92b102 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_32l;
+const_target_desc_up tdesc_powerpc_isa205_32l;
 static void
 initialize_tdesc_powerpc_isa205_32l (void)
 {
@@ -92,5 +92,5 @@ initialize_tdesc_powerpc_isa205_32l (void)
   tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 32, "int");
   tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int");
 
-  tdesc_powerpc_isa205_32l = result.release ();
+  tdesc_powerpc_isa205_32l = std::move (result);
 }
index 9a3621877c070395c411635ad8fcb70572831a20..f9d8de03994645e9b849865ba5c48def881613d3 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_64l;
+const_target_desc_up tdesc_powerpc_isa205_64l;
 static void
 initialize_tdesc_powerpc_isa205_64l (void)
 {
@@ -92,5 +92,5 @@ initialize_tdesc_powerpc_isa205_64l (void)
   tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 64, "int");
   tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int");
 
-  tdesc_powerpc_isa205_64l = result.release ();
+  tdesc_powerpc_isa205_64l = std::move (result);
 }
index e42e1b9229725886b3693e1b3b5a624c99c1c4d9..bb1b5d97274340b39ccf10b5d5e155378db2ea23 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_altivec32l;
+const_target_desc_up tdesc_powerpc_isa205_altivec32l;
 static void
 initialize_tdesc_powerpc_isa205_altivec32l (void)
 {
@@ -155,5 +155,5 @@ initialize_tdesc_powerpc_isa205_altivec32l (void)
   tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int");
   tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
 
-  tdesc_powerpc_isa205_altivec32l = result.release ();
+  tdesc_powerpc_isa205_altivec32l = std::move (result);
 }
index dc43206a9d37645476d65142e68f986d39713984..59ab1f8bef6d31a35e7b259fc534eb47729d33f5 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_altivec64l;
+const_target_desc_up tdesc_powerpc_isa205_altivec64l;
 static void
 initialize_tdesc_powerpc_isa205_altivec64l (void)
 {
@@ -155,5 +155,5 @@ initialize_tdesc_powerpc_isa205_altivec64l (void)
   tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int");
   tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
 
-  tdesc_powerpc_isa205_altivec64l = result.release ();
+  tdesc_powerpc_isa205_altivec64l = std::move (result);
 }
index acc1c5b9a3e7cff47e38a823a6679122f214185a..5108cf7eea8ecae0b0e80b9acc69a8d96cec26ce 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
+const_target_desc_up tdesc_powerpc_isa205_ppr_dscr_vsx32l;
 static void
 initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l (void)
 {
@@ -195,5 +195,5 @@ initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.power.dscr");
   tdesc_create_reg (feature, "dscr", 140, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa205_ppr_dscr_vsx32l = result.release ();
+  tdesc_powerpc_isa205_ppr_dscr_vsx32l = std::move (result);
 }
index 6bfe08d4cb56ea99418e49c57fb97ad1f88de225..15458dd726f92fda5d8a769dc736f17339fd4ead 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
+const_target_desc_up tdesc_powerpc_isa205_ppr_dscr_vsx64l;
 static void
 initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l (void)
 {
@@ -195,5 +195,5 @@ initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.power.dscr");
   tdesc_create_reg (feature, "dscr", 140, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa205_ppr_dscr_vsx64l = result.release ();
+  tdesc_powerpc_isa205_ppr_dscr_vsx64l = std::move (result);
 }
index b3f40b9d009c354404b3142cc3166ff89842ae63..794bcac37d74fcf5c20e09782a5dc43d40975c49 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_vsx32l;
+const_target_desc_up tdesc_powerpc_isa205_vsx32l;
 static void
 initialize_tdesc_powerpc_isa205_vsx32l (void)
 {
@@ -189,5 +189,5 @@ initialize_tdesc_powerpc_isa205_vsx32l (void)
   tdesc_create_reg (feature, "vs30h", 137, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa205_vsx32l = result.release ();
+  tdesc_powerpc_isa205_vsx32l = std::move (result);
 }
index 5f548176701b32be26e78b0acbf3991610b1365e..2de0e9bfd0460ed0f05016c11759314df9849809 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa205_vsx64l;
+const_target_desc_up tdesc_powerpc_isa205_vsx64l;
 static void
 initialize_tdesc_powerpc_isa205_vsx64l (void)
 {
@@ -189,5 +189,5 @@ initialize_tdesc_powerpc_isa205_vsx64l (void)
   tdesc_create_reg (feature, "vs30h", 137, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa205_vsx64l = result.release ();
+  tdesc_powerpc_isa205_vsx64l = std::move (result);
 }
index b9dfd3092159dfb896aa68c33571efb61a6e471c..72153b84e03e9a4f7ca33148aa1d8e01bb102784 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa207_htm_vsx32l;
+const_target_desc_up tdesc_powerpc_isa207_htm_vsx32l;
 static void
 initialize_tdesc_powerpc_isa207_htm_vsx32l (void)
 {
@@ -391,5 +391,5 @@ initialize_tdesc_powerpc_isa207_htm_vsx32l (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.power.htm.tar");
   tdesc_create_reg (feature, "ctar", 290, 0, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa207_htm_vsx32l = result.release ();
+  tdesc_powerpc_isa207_htm_vsx32l = std::move (result);
 }
index 14a911b30aaf710ff27c8085a8659790c014a9fa..18753f2ddfd16d7df0ea6a76d9a27dbc995ffb00 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa207_htm_vsx64l;
+const_target_desc_up tdesc_powerpc_isa207_htm_vsx64l;
 static void
 initialize_tdesc_powerpc_isa207_htm_vsx64l (void)
 {
@@ -391,5 +391,5 @@ initialize_tdesc_powerpc_isa207_htm_vsx64l (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.power.htm.tar");
   tdesc_create_reg (feature, "ctar", 290, 0, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa207_htm_vsx64l = result.release ();
+  tdesc_powerpc_isa207_htm_vsx64l = std::move (result);
 }
index bcfa7c175b8531222dfa6fb0ce39771acc5a8bf9..d31a3309dbe38fa30d3bea3bd27f541c905c7cc1 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa207_vsx32l;
+const_target_desc_up tdesc_powerpc_isa207_vsx32l;
 static void
 initialize_tdesc_powerpc_isa207_vsx32l (void)
 {
@@ -210,5 +210,5 @@ initialize_tdesc_powerpc_isa207_vsx32l (void)
   tdesc_create_reg (feature, "sdar", 148, 0, NULL, 64, "uint64");
   tdesc_create_reg (feature, "sier", 149, 0, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa207_vsx32l = result.release ();
+  tdesc_powerpc_isa207_vsx32l = std::move (result);
 }
index 43bd6e584559e35949093c3c0665320e23079b8b..308bf545f54b7f76c139eeeeeb1a478d547023c1 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_isa207_vsx64l;
+const_target_desc_up tdesc_powerpc_isa207_vsx64l;
 static void
 initialize_tdesc_powerpc_isa207_vsx64l (void)
 {
@@ -210,5 +210,5 @@ initialize_tdesc_powerpc_isa207_vsx64l (void)
   tdesc_create_reg (feature, "sdar", 148, 0, NULL, 64, "uint64");
   tdesc_create_reg (feature, "sier", 149, 0, NULL, 64, "uint64");
 
-  tdesc_powerpc_isa207_vsx64l = result.release ();
+  tdesc_powerpc_isa207_vsx64l = std::move (result);
 }
index 6d60eca340fe1cd8321a66c668624f9d40e0f878..5e82c3db313e43236ea24c28d6e3ae74a2f4ad68 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_vsx32;
+const_target_desc_up tdesc_powerpc_vsx32;
 static void
 initialize_tdesc_powerpc_vsx32 (void)
 {
@@ -185,5 +185,5 @@ initialize_tdesc_powerpc_vsx32 (void)
   tdesc_create_reg (feature, "vs30h", 135, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "vs31h", 136, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_vsx32 = result.release ();
+  tdesc_powerpc_vsx32 = std::move (result);
 }
index cf23313497884293074ba544b8dba0d656fa4f9c..6294ba4b776d8d6b826a4cfa161b7761bc293501 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_vsx32l;
+const_target_desc_up tdesc_powerpc_vsx32l;
 static void
 initialize_tdesc_powerpc_vsx32l (void)
 {
@@ -189,5 +189,5 @@ initialize_tdesc_powerpc_vsx32l (void)
   tdesc_create_reg (feature, "vs30h", 137, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_vsx32l = result.release ();
+  tdesc_powerpc_vsx32l = std::move (result);
 }
index a5baaa2dfdc201ad0dcf77b849b0bb37916f5477..cddd892043913ec7600d243e92c31712d3d00501 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_vsx64;
+const_target_desc_up tdesc_powerpc_vsx64;
 static void
 initialize_tdesc_powerpc_vsx64 (void)
 {
@@ -185,5 +185,5 @@ initialize_tdesc_powerpc_vsx64 (void)
   tdesc_create_reg (feature, "vs30h", 135, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "vs31h", 136, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_vsx64 = result.release ();
+  tdesc_powerpc_vsx64 = std::move (result);
 }
index 03d2b694b7d01255f5e66c82a1fad39e016e644a..c6deea9d2c2e87044d1beb425f2217c430a209ec 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_powerpc_vsx64l;
+const_target_desc_up tdesc_powerpc_vsx64l;
 static void
 initialize_tdesc_powerpc_vsx64l (void)
 {
@@ -189,5 +189,5 @@ initialize_tdesc_powerpc_vsx64l (void)
   tdesc_create_reg (feature, "vs30h", 137, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
 
-  tdesc_powerpc_vsx64l = result.release ();
+  tdesc_powerpc_vsx64l = std::move (result);
 }
index 210dd96e4f61c493faeec66729d73ce0eadf04b2..cee13f9b2eaecbb34d2992e97d7c96d74c107298 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_rs6000;
+const_target_desc_up tdesc_rs6000;
 static void
 initialize_tdesc_rs6000 (void)
 {
@@ -89,5 +89,5 @@ initialize_tdesc_rs6000 (void)
   tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double");
   tdesc_create_reg (feature, "fpscr", 71, 1, "float", 32, "int");
 
-  tdesc_rs6000 = result.release ();
+  tdesc_rs6000 = std::move (result);
 }
index f9a5584f9b807ce48b0ab9cd30880967ed91604b..44023fe26fe2ffff2ab927534ac3e08918fe3c32 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_rx;
+const_target_desc_up tdesc_rx;
 static void
 initialize_tdesc_rx (void)
 {
@@ -75,5 +75,5 @@ initialize_tdesc_rx (void)
   tdesc_create_reg (feature, "fpsw", 24, 1, NULL, 32, "fpsw_flags");
   tdesc_create_reg (feature, "acc", 25, 1, NULL, 64, "uint64");
 
-  tdesc_rx = result.release ();
+  tdesc_rx = std::move (result);
 }
index ab6ad6f21e3a90a61709f4bfb22fdcc2ca47b31b..b3d22806ac227045b7fdb18860ed1503fc7ec18e 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_gs_linux64;
+const_target_desc_up tdesc_s390_gs_linux64;
 static void
 initialize_tdesc_s390_gs_linux64 (void)
 {
@@ -196,5 +196,5 @@ initialize_tdesc_s390_gs_linux64 (void)
   tdesc_create_reg (feature, "bc_gssm", 126, 1, "gs", 64, "uint64");
   tdesc_create_reg (feature, "bc_gsepla", 127, 1, "gs", 64, "data_ptr");
 
-  tdesc_s390_gs_linux64 = result.release ();
+  tdesc_s390_gs_linux64 = std::move (result);
 }
index e45321a209961a72a378a6b4ce426d6e7cd620c0..62b4b53ae988fb8e1aeeb4cad0ff023b0cc425d4 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_linux32;
+const_target_desc_up tdesc_s390_linux32;
 static void
 initialize_tdesc_s390_linux32 (void)
 {
@@ -75,5 +75,5 @@ initialize_tdesc_s390_linux32 (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.s390.linux");
   tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 32, "uint32");
 
-  tdesc_s390_linux32 = result.release ();
+  tdesc_s390_linux32 = std::move (result);
 }
index cea14c169696a896f64ef853b357a2ff81c3d3ae..cef4dcb28876d96d237848429b4ef996814afe2c 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_linux32v1;
+const_target_desc_up tdesc_s390_linux32v1;
 static void
 initialize_tdesc_s390_linux32v1 (void)
 {
@@ -76,5 +76,5 @@ initialize_tdesc_s390_linux32v1 (void)
   tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 32, "uint32");
   tdesc_create_reg (feature, "last_break", 52, 0, "system", 32, "code_ptr");
 
-  tdesc_s390_linux32v1 = result.release ();
+  tdesc_s390_linux32v1 = std::move (result);
 }
index 182ab2f0b609f4d58211e9fa427de6b54f3bd866..35498b2a27579a582d7ebbbc7f794f267cdae5ed 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_linux32v2;
+const_target_desc_up tdesc_s390_linux32v2;
 static void
 initialize_tdesc_s390_linux32v2 (void)
 {
@@ -77,5 +77,5 @@ initialize_tdesc_s390_linux32v2 (void)
   tdesc_create_reg (feature, "last_break", 52, 0, "system", 32, "code_ptr");
   tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32");
 
-  tdesc_s390_linux32v2 = result.release ();
+  tdesc_s390_linux32v2 = std::move (result);
 }
index 8bcec095174c156c7eb347fbdb3d5a9b9a9ea302..2a9f16bb40c3f481068e87ff2b1cce9ff44c8ed9 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_linux64;
+const_target_desc_up tdesc_s390_linux64;
 static void
 initialize_tdesc_s390_linux64 (void)
 {
@@ -91,5 +91,5 @@ initialize_tdesc_s390_linux64 (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.s390.linux");
   tdesc_create_reg (feature, "orig_r2", 67, 1, "system", 32, "uint32");
 
-  tdesc_s390_linux64 = result.release ();
+  tdesc_s390_linux64 = std::move (result);
 }
index 3a6394b513d0285efbdd06655cd9f96df3ac9e8c..ff592c318e2d3bee14487a60199ed8bb86dc9067 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_linux64v1;
+const_target_desc_up tdesc_s390_linux64v1;
 static void
 initialize_tdesc_s390_linux64v1 (void)
 {
@@ -92,5 +92,5 @@ initialize_tdesc_s390_linux64v1 (void)
   tdesc_create_reg (feature, "orig_r2", 67, 1, "system", 32, "uint32");
   tdesc_create_reg (feature, "last_break", 68, 0, "system", 32, "code_ptr");
 
-  tdesc_s390_linux64v1 = result.release ();
+  tdesc_s390_linux64v1 = std::move (result);
 }
index 5ff9a5709ef1640b2cfb8e9bcccc6ab9158150ed..0e1daad1475e079e886699041203c6f378dc490b 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_linux64v2;
+const_target_desc_up tdesc_s390_linux64v2;
 static void
 initialize_tdesc_s390_linux64v2 (void)
 {
@@ -93,5 +93,5 @@ initialize_tdesc_s390_linux64v2 (void)
   tdesc_create_reg (feature, "last_break", 68, 0, "system", 32, "code_ptr");
   tdesc_create_reg (feature, "system_call", 69, 1, "system", 32, "uint32");
 
-  tdesc_s390_linux64v2 = result.release ();
+  tdesc_s390_linux64v2 = std::move (result);
 }
index 2abddd53bfa72d3ddd23d8d344f80bcffcd5748e..5a03beb17505d77dfddcb308b3828b792090f543 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_te_linux64;
+const_target_desc_up tdesc_s390_te_linux64;
 static void
 initialize_tdesc_s390_te_linux64 (void)
 {
@@ -115,5 +115,5 @@ initialize_tdesc_s390_te_linux64 (void)
   tdesc_create_reg (feature, "tr14", 88, 1, "tdb", 64, "uint64");
   tdesc_create_reg (feature, "tr15", 89, 1, "tdb", 64, "uint64");
 
-  tdesc_s390_te_linux64 = result.release ();
+  tdesc_s390_te_linux64 = std::move (result);
 }
index 8e38a5cf81fd1e3ae60ea792096744d65b2fc7ed..47954109719fccf2bda00926f0b92f40f56a2549 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_tevx_linux64;
+const_target_desc_up tdesc_s390_tevx_linux64;
 static void
 initialize_tdesc_s390_tevx_linux64 (void)
 {
@@ -186,5 +186,5 @@ initialize_tdesc_s390_tevx_linux64 (void)
   tdesc_create_reg (feature, "v30", 120, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "v31", 121, 1, NULL, 128, "vec128");
 
-  tdesc_s390_tevx_linux64 = result.release ();
+  tdesc_s390_tevx_linux64 = std::move (result);
 }
index 1ce5ad3671ac67aaa3ef5c0a74117bf8a27e53d9..a4c523897d2357f9317773c13d91e0de3934b815 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390_vx_linux64;
+const_target_desc_up tdesc_s390_vx_linux64;
 static void
 initialize_tdesc_s390_vx_linux64 (void)
 {
@@ -164,5 +164,5 @@ initialize_tdesc_s390_vx_linux64 (void)
   tdesc_create_reg (feature, "v30", 100, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "v31", 101, 1, NULL, 128, "vec128");
 
-  tdesc_s390_vx_linux64 = result.release ();
+  tdesc_s390_vx_linux64 = std::move (result);
 }
index 76b8124863a44128af5f0d8aaf3ad284d3b8266d..35626366ff1c3a09f62da7a197d53a15ad8e3818 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390x_gs_linux64;
+const_target_desc_up tdesc_s390x_gs_linux64;
 static void
 initialize_tdesc_s390x_gs_linux64 (void)
 {
@@ -180,5 +180,5 @@ initialize_tdesc_s390x_gs_linux64 (void)
   tdesc_create_reg (feature, "bc_gssm", 110, 1, "gs", 64, "uint64");
   tdesc_create_reg (feature, "bc_gsepla", 111, 1, "gs", 64, "data_ptr");
 
-  tdesc_s390x_gs_linux64 = result.release ();
+  tdesc_s390x_gs_linux64 = std::move (result);
 }
index eb6b181f599730b134f5dc002fb2529a8002dacc..3ccc2574a5118763033d161d4b565e37e111ed18 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390x_linux64;
+const_target_desc_up tdesc_s390x_linux64;
 static void
 initialize_tdesc_s390x_linux64 (void)
 {
@@ -75,5 +75,5 @@ initialize_tdesc_s390x_linux64 (void)
   feature = tdesc_create_feature (result.get (), "org.gnu.gdb.s390.linux");
   tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 64, "uint64");
 
-  tdesc_s390x_linux64 = result.release ();
+  tdesc_s390x_linux64 = std::move (result);
 }
index 6b43f88ac842389da70e91f70f95fda28c7dbf0b..efda35e3aef37fce5ed38b37c65685e6084d550c 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390x_linux64v1;
+const_target_desc_up tdesc_s390x_linux64v1;
 static void
 initialize_tdesc_s390x_linux64v1 (void)
 {
@@ -76,5 +76,5 @@ initialize_tdesc_s390x_linux64v1 (void)
   tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 64, "uint64");
   tdesc_create_reg (feature, "last_break", 52, 0, "system", 64, "code_ptr");
 
-  tdesc_s390x_linux64v1 = result.release ();
+  tdesc_s390x_linux64v1 = std::move (result);
 }
index eeba787ec7b708867ced4e48f420fb4bc7c51661..1a7ea9dc48967a07c08e05e2b4870e6b2001ad5c 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390x_linux64v2;
+const_target_desc_up tdesc_s390x_linux64v2;
 static void
 initialize_tdesc_s390x_linux64v2 (void)
 {
@@ -77,5 +77,5 @@ initialize_tdesc_s390x_linux64v2 (void)
   tdesc_create_reg (feature, "last_break", 52, 0, "system", 64, "code_ptr");
   tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32");
 
-  tdesc_s390x_linux64v2 = result.release ();
+  tdesc_s390x_linux64v2 = std::move (result);
 }
index 0fec2b0bd027188e9cbc22f414c10cb99b375adb..b6b61a05b4d8a79838696717157659923fa20fac 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390x_te_linux64;
+const_target_desc_up tdesc_s390x_te_linux64;
 static void
 initialize_tdesc_s390x_te_linux64 (void)
 {
@@ -99,5 +99,5 @@ initialize_tdesc_s390x_te_linux64 (void)
   tdesc_create_reg (feature, "tr14", 72, 1, "tdb", 64, "uint64");
   tdesc_create_reg (feature, "tr15", 73, 1, "tdb", 64, "uint64");
 
-  tdesc_s390x_te_linux64 = result.release ();
+  tdesc_s390x_te_linux64 = std::move (result);
 }
index c1b890045d3169bea9878b161677089459ba8023..104e467df9d6617ecc73d33088ae8b1f3e4ef97a 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390x_tevx_linux64;
+const_target_desc_up tdesc_s390x_tevx_linux64;
 static void
 initialize_tdesc_s390x_tevx_linux64 (void)
 {
@@ -170,5 +170,5 @@ initialize_tdesc_s390x_tevx_linux64 (void)
   tdesc_create_reg (feature, "v30", 104, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "v31", 105, 1, NULL, 128, "vec128");
 
-  tdesc_s390x_tevx_linux64 = result.release ();
+  tdesc_s390x_tevx_linux64 = std::move (result);
 }
index af57e052eab2a0f2241cce45c4503b6c8d43fe64..af0ac984fcbe41c1de120ee27e01bf84ae770952 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_s390x_vx_linux64;
+const_target_desc_up tdesc_s390x_vx_linux64;
 static void
 initialize_tdesc_s390x_vx_linux64 (void)
 {
@@ -148,5 +148,5 @@ initialize_tdesc_s390x_vx_linux64 (void)
   tdesc_create_reg (feature, "v30", 84, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "v31", 85, 1, NULL, 128, "vec128");
 
-  tdesc_s390x_vx_linux64 = result.release ();
+  tdesc_s390x_vx_linux64 = std::move (result);
 }
index 70affdbc5b5d5fd392466a5f20a27b842d37066b..c46175bc8c324caa5213b0b6e3d7f8f03e04cbe0 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_sparc32_solaris;
+const_target_desc_up tdesc_sparc32_solaris;
 static void
 initialize_tdesc_sparc32_solaris (void)
 {
@@ -93,5 +93,5 @@ initialize_tdesc_sparc32_solaris (void)
   tdesc_create_reg (feature, "f30", 62, 1, NULL, 32, "ieee_single");
   tdesc_create_reg (feature, "f31", 63, 1, NULL, 32, "ieee_single");
 
-  tdesc_sparc32_solaris = result.release ();
+  tdesc_sparc32_solaris = std::move (result);
 }
index 98edabe38644d29f76529ad742ab48508d3496c9..40c83f93fe724ca50bceff949b290030f0713ac4 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_sparc64_solaris;
+const_target_desc_up tdesc_sparc64_solaris;
 static void
 initialize_tdesc_sparc64_solaris (void)
 {
@@ -107,5 +107,5 @@ initialize_tdesc_sparc64_solaris (void)
   tdesc_create_reg (feature, "f60", 78, 1, NULL, 64, "ieee_double");
   tdesc_create_reg (feature, "f62", 79, 1, NULL, 64, "ieee_double");
 
-  tdesc_sparc64_solaris = result.release ();
+  tdesc_sparc64_solaris = std::move (result);
 }
index 627649cc69017fe07171ff86399b9656e6c6aa19..6cf38ffb9e4ee7a4886bd9e78cafacf94dc68656 100644 (file)
@@ -4,7 +4,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-const struct target_desc *tdesc_z80;
+const_target_desc_up tdesc_z80;
 static void
 initialize_tdesc_z80 (void)
 {
@@ -39,5 +39,5 @@ initialize_tdesc_z80 (void)
   tdesc_create_reg (feature, "hl'", 11, 1, NULL, 16, "data_ptr");
   tdesc_create_reg (feature, "ir", 12, 1, NULL, 16, "uint16");
 
-  tdesc_z80 = result.release ();
+  tdesc_z80 = std::move (result);
 }
index 8996b80f5bcfc02f371539946b1bce9657a1c9fe..a4eee1e9869f0afdfbee15f7a8cf2196d5b412bd 100644 (file)
@@ -9116,25 +9116,25 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
 /* See i386-tdep.h.  */
 
-const struct target_desc *
+const target_desc *
 i386_target_description (uint64_t xstate_bv, bool segments)
 {
-  static target_desc *i386_tdescs \
+  static const_target_desc_up i386_tdescs \
     [2/*SSE*/][2/*AVX*/][2/*AVX512*/][2/*PKRU*/][2/*CET_U*/] \
     [2/*segments*/] = {};
-  target_desc **tdesc;
 
-  tdesc = &i386_tdescs[(xstate_bv & X86_XSTATE_SSE) ? 1 : 0]
-    [(xstate_bv & X86_XSTATE_AVX) ? 1 : 0]
-    [(xstate_bv & X86_XSTATE_AVX512) ? 1 : 0]
-    [(xstate_bv & X86_XSTATE_PKRU) ? 1 : 0]
-    [(xstate_bv & X86_XSTATE_CET_U) ? 1 : 0]
-    [segments ? 1 : 0];
+  const_target_desc_up &tdesc
+    = i386_tdescs[(xstate_bv & X86_XSTATE_SSE) ? 1 : 0]
+                [(xstate_bv & X86_XSTATE_AVX) ? 1 : 0]
+                [(xstate_bv & X86_XSTATE_AVX512) ? 1 : 0]
+                [(xstate_bv & X86_XSTATE_PKRU) ? 1 : 0]
+                [(xstate_bv & X86_XSTATE_CET_U) ? 1 : 0]
+                [segments ? 1 : 0];
 
-  if (*tdesc == NULL)
-    *tdesc = i386_create_target_description (xstate_bv, false, segments);
+  if (tdesc == nullptr)
+    tdesc = i386_create_target_description (xstate_bv, false, segments);
 
-  return *tdesc;
+  return tdesc.get ();
 }
 
 INIT_GDB_FILE (i386_tdep)
index f4ab2ec595fba50bd2ef8c47fb7c4300b5eedb13..3ee3372181980a74967f3570f8a97ae259b5977b 100644 (file)
@@ -711,11 +711,11 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
 {
   register_remote_g_packet_guess (gdbarch,
                                  4 * MICROBLAZE_NUM_CORE_REGS,
-                                 tdesc_microblaze);
+                                 tdesc_microblaze.get ());
 
   register_remote_g_packet_guess (gdbarch,
                                  4 * MICROBLAZE_NUM_REGS,
-                                 tdesc_microblaze_with_stack_protect);
+                                 tdesc_microblaze_with_stack_protect.get ());
 }
 
 static struct gdbarch *
@@ -729,7 +729,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   if (arches != NULL)
     return arches->gdbarch;
   if (tdesc == NULL)
-    tdesc = tdesc_microblaze;
+    tdesc = tdesc_microblaze.get ();
 
   /* Check any target description for validity.  */
   if (tdesc_has_registers (tdesc))
index b90b546f5727c859e582e2e81347eff61bca7a26..a26ae039cfad398abb723eddd0e988340c1e6c53 100644 (file)
@@ -459,7 +459,8 @@ mips_linux_nat_target::read_description ()
     {
       /* Assume no DSP if there is no inferior to inspect with ptrace.  */
       if (inferior_ptid == null_ptid)
-       return _MIPS_SIM == _ABIO32 ? tdesc_mips_linux : tdesc_mips64_linux;
+       return (_MIPS_SIM == _ABIO32
+               ? tdesc_mips_linux : tdesc_mips64_linux).get ();
 
       int tid = get_ptrace_pid (inferior_ptid);
 
@@ -482,9 +483,9 @@ mips_linux_nat_target::read_description ()
   /* Report that target registers are a size we know for sure
      that we can get from ptrace.  */
   if (_MIPS_SIM == _ABIO32)
-    return have_dsp ? tdesc_mips_dsp_linux : tdesc_mips_linux;
+    return (have_dsp ? tdesc_mips_dsp_linux : tdesc_mips_linux).get ();
   else
-    return have_dsp ? tdesc_mips64_dsp_linux : tdesc_mips64_linux;
+    return (have_dsp ? tdesc_mips64_dsp_linux : tdesc_mips64_linux).get ();
 }
 
 /* -1 if the kernel and/or CPU do not support watch registers.
index 362c1488c5f62c4c322c98e83403f7793c950eb6..7e5ec9f4d081b1a3e713f24fa323451faf1b322e 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef GDB_MIPS_LINUX_TDEP_H
 #define GDB_MIPS_LINUX_TDEP_H
 
+#include "gdbsupport/tdesc.h"
+
 /* Copied from <asm/elf.h>.  */
 #define ELF_NGREG       45
 #define ELF_NFPREG      33
@@ -108,9 +110,9 @@ enum {
 int mips_linux_restart_reg_p (struct gdbarch *gdbarch);
 
 /* Target descriptions.  */
-extern const struct target_desc *tdesc_mips_linux;
-extern const struct target_desc *tdesc_mips64_linux;
-extern const struct target_desc *tdesc_mips_dsp_linux;
-extern const struct target_desc *tdesc_mips64_dsp_linux;
+extern const_target_desc_up tdesc_mips_linux;
+extern const_target_desc_up tdesc_mips64_linux;
+extern const_target_desc_up tdesc_mips_dsp_linux;
+extern const_target_desc_up tdesc_mips64_dsp_linux;
 
 #endif /* GDB_MIPS_LINUX_TDEP_H */
index f0a0b338931b062848fa3593d195605c40d7a41e..80a2e1c706d532f4ae873865a3ee8628bf0c1887 100644 (file)
@@ -1974,7 +1974,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     return best_arch->gdbarch;
 
   if (!tdesc_has_registers (tdesc))
-    tdesc = tdesc_nds32;
+    tdesc = tdesc_nds32.get ();
 
   tdesc_data = tdesc_data_alloc ();
 
index 442bdaf9fab95cc52ff688f88f0726355eeabcc3..52222fef1dc9e44d876d0f092977d118a147e6bd 100644 (file)
@@ -1234,7 +1234,7 @@ or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   if (!tdesc_has_registers (info.target_desc))
     /* Pick a default target description.  */
-    tdesc = tdesc_or1k;
+    tdesc = tdesc_or1k.get ();
 
   /* Check any target description for validity.  */
   if (tdesc_has_registers (tdesc))
index 27586d9a7350cb6dd7889337aacf38cbac76dc0d..fd425654df7fd312d9491797bebce9bbae336a82 100644 (file)
@@ -1955,7 +1955,7 @@ ppc_linux_nat_target::read_description ()
       struct gdb_evrregset_t evrregset;
 
       if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0)
-       return tdesc_powerpc_e500l;
+       return tdesc_powerpc_e500l.get ();
 
       /* EIO means that the PTRACE_GETEVRREGS request isn't supported.
         Anything else needs to be reported.  */
index bf0e82a2820eb1e1f0f272e6637e6c6e5e10c8d6..f5d60b58ea035f17f7658d0e47c18e99ea81c27f 100644 (file)
@@ -21,6 +21,7 @@
 #define GDB_PPC_TDEP_H
 
 #include "gdbarch.h"
+#include "gdbsupport/tdesc.h"
 
 struct gdbarch;
 class frame_info_ptr;
@@ -452,10 +453,10 @@ struct ppc_inferior_data
 
 extern ppc_inferior_data * get_ppc_per_inferior (inferior *inf);
 
-extern const struct target_desc *tdesc_powerpc_vsx64l;
-extern const struct target_desc *tdesc_powerpc_vsx64;
-extern const struct target_desc *tdesc_powerpc_vsx32;
-extern const struct target_desc *tdesc_powerpc_altivec64;
-extern const struct target_desc *tdesc_powerpc_altivec32;
+extern const_target_desc_up tdesc_powerpc_vsx64l;
+extern const_target_desc_up tdesc_powerpc_vsx64;
+extern const_target_desc_up tdesc_powerpc_vsx32;
+extern const_target_desc_up tdesc_powerpc_altivec64;
+extern const_target_desc_up tdesc_powerpc_altivec32;
 
 #endif /* GDB_PPC_TDEP_H */
index 2b0cf8577fa2bf3d8e5cd1ced9b443408ebf2fd7..29f4735ca936c19e4aef89b7cd2cf980bb9dc6b8 100644 (file)
@@ -689,16 +689,16 @@ rs6000_nat_target::read_description ()
    if (ARCH64())
      {
        if (__power_vsx ())
-        return tdesc_powerpc_vsx64;
+        return tdesc_powerpc_vsx64.get ();
        else if (__power_vmx ())
-        return tdesc_powerpc_altivec64;
+        return tdesc_powerpc_altivec64.get ();
      }
    else
      {
        if (__power_vsx ())
-        return tdesc_powerpc_vsx32;
+        return tdesc_powerpc_vsx32.get ();
        else if (__power_vmx ())
-        return tdesc_powerpc_altivec32;
+        return tdesc_powerpc_altivec32.get ();
      }
    return NULL;
 }
index ae1fb958628b71b13bef8d460022f8d669ee5c74..366235f1919e33b08e818300dcc210de95b7cb5d 100644 (file)
@@ -470,13 +470,13 @@ ppc_aix_core_read_description (struct gdbarch *gdbarch,
     arch64 = 1;
 
   if (vsx && arch64)
-    return tdesc_powerpc_vsx64;
+    return tdesc_powerpc_vsx64.get ();
   else if (vsx && !arch64)
-    return tdesc_powerpc_vsx32;
+    return tdesc_powerpc_vsx32.get ();
   else if (altivec && arch64)
-    return tdesc_powerpc_altivec64;
+    return tdesc_powerpc_altivec64.get ();
   else if (altivec && !arch64)
-    return tdesc_powerpc_altivec32;
+    return tdesc_powerpc_altivec32.get ();
 
   return NULL;
 }
index b73ab87b69910c7461c14d3507eb649a7b455fdf..3184952b84868de3b2eb60edf7f3e9f4289b45dc 100644 (file)
@@ -3525,7 +3525,7 @@ struct ppc_variant
     unsigned long mach;
 
     /* Target description for this variant.  */
-    const struct target_desc **tdesc;
+    const_target_desc_up *tdesc;
   };
 
 static const ppc_variant variants[] =
@@ -7676,7 +7676,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       if (!v)
        return NULL;
 
-      tdesc = *v->tdesc;
+      tdesc = v->tdesc->get ();
     }
 
   gdb_assert (tdesc_has_registers (tdesc));
index c7b1dfa6ae7ef8bdef1b05ed002eb68df0919fd1..0e073ad5504fcde3e3d202780fc6f03b9c10f245 100644 (file)
@@ -975,7 +975,7 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     }
 
   if (tdesc == NULL)
-      tdesc = tdesc_rx;
+    tdesc = tdesc_rx.get ();
 
   /* Check any target description for validity.  */
   if (tdesc_has_registers (tdesc))
index 5b723b10680a08aff459a677cde9e56a231d2b40..a4745e4fc4ebd42f623842e1e1de2e8529f2bc88 100644 (file)
@@ -1029,7 +1029,7 @@ s390_linux_nat_target::read_description ()
              have_regset_tdb ? tdesc_s390x_te_linux64 :
              have_regset_system_call ? tdesc_s390x_linux64v2 :
              have_regset_last_break ? tdesc_s390x_linux64v1 :
-             tdesc_s390x_linux64);
+             tdesc_s390x_linux64).get ();
 
     if (hwcap & HWCAP_S390_HIGH_GPRS)
       return (have_regset_gs ? tdesc_s390_gs_linux64 :
@@ -1039,7 +1039,7 @@ s390_linux_nat_target::read_description ()
              have_regset_tdb ? tdesc_s390_te_linux64 :
              have_regset_system_call ? tdesc_s390_linux64v2 :
              have_regset_last_break ? tdesc_s390_linux64v1 :
-             tdesc_s390_linux64);
+             tdesc_s390_linux64).get ();
   }
 #endif
 
@@ -1048,7 +1048,7 @@ s390_linux_nat_target::read_description ()
      mode, report s390 architecture with 32-bit GPRs.  */
   return (have_regset_system_call? tdesc_s390_linux32v2 :
          have_regset_last_break? tdesc_s390_linux32v1 :
-         tdesc_s390_linux32);
+         tdesc_s390_linux32).get ();
 }
 
 INIT_GDB_FILE (s390_nat)
index 593befb495a9325f3882f170c2d531725fcf1132..23f13a650a5aaf2a51c588958d0d7df35864e572 100644 (file)
@@ -358,10 +358,10 @@ s390_core_read_description (struct gdbarch *gdbarch,
                vx ? tdesc_s390_vx_linux64 :
                te ? tdesc_s390_te_linux64 :
                v2 ? tdesc_s390_linux64v2 :
-               v1 ? tdesc_s390_linux64v1 : tdesc_s390_linux64);
+               v1 ? tdesc_s390_linux64v1 : tdesc_s390_linux64).get ();
       else
        return (v2 ? tdesc_s390_linux32v2 :
-               v1 ? tdesc_s390_linux32v1 : tdesc_s390_linux32);
+               v1 ? tdesc_s390_linux32v1 : tdesc_s390_linux32).get ();
 
     case s390x_sizeof_gregset:
       return (gs ? tdesc_s390x_gs_linux64 :
@@ -369,7 +369,7 @@ s390_core_read_description (struct gdbarch *gdbarch,
              vx ? tdesc_s390x_vx_linux64 :
              te ? tdesc_s390x_te_linux64 :
              v2 ? tdesc_s390x_linux64v2 :
-             v1 ? tdesc_s390x_linux64v1 : tdesc_s390x_linux64);
+             v1 ? tdesc_s390x_linux64v1 : tdesc_s390x_linux64).get ();
 
     default:
       return NULL;
index 05ef893f64d9b3755f80cca3df570be77af674c6..7044e0b2c9732a3b22a0b8d1b711e8c1dee903c1 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef GDB_S390_LINUX_TDEP_H
 #define GDB_S390_LINUX_TDEP_H
 
+#include "gdbsupport/tdesc.h"
+
 #define S390_IS_GREGSET_REGNUM(i)                                      \
   (((i) >= S390_PSWM_REGNUM && (i) <= S390_A15_REGNUM)                 \
    || ((i) >= S390_R0_UPPER_REGNUM && (i) <= S390_R15_UPPER_REGNUM)    \
@@ -48,20 +50,20 @@ extern const struct regset s390_gs_regset;
 extern const struct regset s390_gsbc_regset;
 
 /* GNU/Linux target descriptions.  */
-extern const struct target_desc *tdesc_s390_linux32v1;
-extern const struct target_desc *tdesc_s390_linux32v2;
-extern const struct target_desc *tdesc_s390_linux64;
-extern const struct target_desc *tdesc_s390_linux64v1;
-extern const struct target_desc *tdesc_s390_linux64v2;
-extern const struct target_desc *tdesc_s390_te_linux64;
-extern const struct target_desc *tdesc_s390_vx_linux64;
-extern const struct target_desc *tdesc_s390_tevx_linux64;
-extern const struct target_desc *tdesc_s390_gs_linux64;
-extern const struct target_desc *tdesc_s390x_linux64v1;
-extern const struct target_desc *tdesc_s390x_linux64v2;
-extern const struct target_desc *tdesc_s390x_te_linux64;
-extern const struct target_desc *tdesc_s390x_vx_linux64;
-extern const struct target_desc *tdesc_s390x_tevx_linux64;
-extern const struct target_desc *tdesc_s390x_gs_linux64;
+extern const_target_desc_up tdesc_s390_linux32v1;
+extern const_target_desc_up tdesc_s390_linux32v2;
+extern const_target_desc_up tdesc_s390_linux64;
+extern const_target_desc_up tdesc_s390_linux64v1;
+extern const_target_desc_up tdesc_s390_linux64v2;
+extern const_target_desc_up tdesc_s390_te_linux64;
+extern const_target_desc_up tdesc_s390_vx_linux64;
+extern const_target_desc_up tdesc_s390_tevx_linux64;
+extern const_target_desc_up tdesc_s390_gs_linux64;
+extern const_target_desc_up tdesc_s390x_linux64v1;
+extern const_target_desc_up tdesc_s390x_linux64v2;
+extern const_target_desc_up tdesc_s390x_te_linux64;
+extern const_target_desc_up tdesc_s390x_vx_linux64;
+extern const_target_desc_up tdesc_s390x_tevx_linux64;
+extern const_target_desc_up tdesc_s390x_gs_linux64;
 
 #endif /* GDB_S390_LINUX_TDEP_H */
index ccffafcecab1ad6571551510f01134d8dbad9c46..e47832e474c4a471aa264630ae22ddcbbd3ce1b6 100644 (file)
@@ -7392,9 +7392,9 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   if (!tdesc_has_registers (tdesc))
     {
       if (info.bfd_arch_info->mach == bfd_mach_s390_31)
-       tdesc = tdesc_s390_linux32;
+       tdesc = tdesc_s390_linux32.get ();
       else
-       tdesc = tdesc_s390x_linux64;
+       tdesc = tdesc_s390x_linux64.get ();
     }
   tdep->tdesc = tdesc;
 
index 80ca3b4b56c5627259657b51fcde77ed970cafe6..cd720793d4319bf21ea41971414b294a5f4951db 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef GDB_S390_TDEP_H
 #define GDB_S390_TDEP_H
 
+#include "gdbsupport/tdesc.h"
 #include "prologue-value.h"
 #include "gdbarch.h"
 
@@ -320,7 +321,7 @@ extern struct value *s390_trad_frame_prev_register
     (const frame_info_ptr &this_frame, struct trad_frame_saved_reg saved_regs[],
      int regnum);
 
-extern const struct target_desc *tdesc_s390_linux32;
-extern const struct target_desc *tdesc_s390x_linux64;
+extern const_target_desc_up tdesc_s390_linux32;
+extern const_target_desc_up tdesc_s390x_linux64;
 
 #endif /* GDB_S390_TDEP_H */
index 858a019e615212ff80c68904355a752c470be566..46e2219c9716f3b930accffa405bb82849fe9862 100644 (file)
@@ -1134,7 +1134,7 @@ allocate_target_description (void)
 /* See gdbsupport/tdesc.h.  */
 
 void
-target_desc_deleter::operator() (struct target_desc *target_desc) const
+target_desc_deleter::operator() (const target_desc *target_desc) const
 {
   delete target_desc;
 }
@@ -1292,7 +1292,7 @@ public:
     gdb_printf ("#include \"target-descriptions.h\"\n");
     gdb_printf ("\n");
 
-    gdb_printf ("const struct target_desc *tdesc_%s;\n", m_function);
+    gdb_printf ("const_target_desc_up tdesc_%s;\n", m_function);
     gdb_printf ("static void\n");
     gdb_printf ("initialize_tdesc_%s (void)\n", m_function);
     gdb_printf ("{\n");
@@ -1340,7 +1340,7 @@ public:
 
   void visit_post (const target_desc *e) override
   {
-    gdb_printf ("\n  tdesc_%s = result.release ();\n", m_function);
+    gdb_printf ("\n  tdesc_%s = std::move (result);\n", m_function);
     gdb_printf ("}\n");
   }
 
index 6a099cd6e74a96e208331586f7777317a839ef67..b07d6b15385b47401f78cb97b05c7c3f1775112d 100644 (file)
@@ -1085,8 +1085,10 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   const struct target_desc *tdesc = info.target_desc;
 
   if (!tdesc_has_registers (tdesc))
-    /* Pick a default target description.  */
-    tdesc = tdesc_z80;
+    {
+      /* Pick a default target description.  */
+      tdesc = tdesc_z80.get ();
+    }
 
   /* Check any target description for validity.  */
   if (tdesc_has_registers (tdesc))
index 675eb58e2c4b2ed075efffe205bfdf091e24376a..c97d52ef85992f35718fd41cb36832d676c47687 100644 (file)
@@ -22,7 +22,7 @@
 #include "arch/aarch32.h"
 #include <inttypes.h>
 
-static struct target_desc *tdesc_aarch32;
+static const_target_desc_up tdesc_aarch32;
 
 /* See linux-aarch32-tdesc.h.  */
 
@@ -31,12 +31,13 @@ aarch32_linux_read_description ()
 {
   if (tdesc_aarch32 == nullptr)
     {
-      tdesc_aarch32 = aarch32_create_target_description (false);
+      target_desc_up new_tdesc = aarch32_create_target_description (false);
 
       static const char *expedite_regs[] = { "r11", "sp", "pc", 0 };
-      init_target_desc (tdesc_aarch32, expedite_regs, GDB_OSABI_LINUX);
+      init_target_desc (new_tdesc.get (), expedite_regs, GDB_OSABI_LINUX);
+      tdesc_aarch32 = std::move (new_tdesc);
     }
-  return tdesc_aarch32;
+  return tdesc_aarch32.get ();
 }
 
 /* See linux-aarch32-tdesc.h.  */
@@ -45,5 +46,5 @@ bool
 is_aarch32_linux_description (const target_desc *tdesc)
 {
   gdb_assert (tdesc != nullptr);
-  return tdesc == tdesc_aarch32;
+  return tdesc == tdesc_aarch32.get ();
 }
index cbd049dbd244c7cdaa8a528136f2554e1ec7262f..eef43754afd6a30f6f857105f4b0c669678addce 100644 (file)
@@ -35,7 +35,8 @@ aarch64_linux_read_description (const aarch64_features &features)
      this function as the in-process-agent calls this function from a
      constructor function, when globals might not yet have been
      initialised.  */
-  static gdb::unordered_map<aarch64_features, target_desc *> tdesc_aarch64_map;
+  static gdb::unordered_map<aarch64_features, const_target_desc_up>
+    tdesc_aarch64_map;
 
   if (features.vq > AARCH64_MAX_SVE_VQ)
     error (_("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq,
@@ -46,11 +47,11 @@ aarch64_linux_read_description (const aarch64_features &features)
           features.svq,
           AARCH64_MAX_SVE_VQ);
 
-  struct target_desc *tdesc = tdesc_aarch64_map[features];
+  const_target_desc_up &tdesc = tdesc_aarch64_map[features];
 
-  if (tdesc == NULL)
+  if (tdesc == nullptr)
     {
-      tdesc = aarch64_create_target_description (features);
+      target_desc_up new_tdesc = aarch64_create_target_description (features);
 
       /* Configure the expedited registers.  Calling init_target_desc takes
         a copy of all the strings pointed to by expedited_registers so this
@@ -67,11 +68,11 @@ aarch64_linux_read_description (const aarch64_features &features)
 
       expedited_registers.push_back (nullptr);
 
-      init_target_desc (tdesc, (const char **) expedited_registers.data (),
+      init_target_desc (new_tdesc.get (), (const char **) expedited_registers.data (),
                        GDB_OSABI_LINUX);
 
-      tdesc_aarch64_map[features] = tdesc;
+      tdesc = std::move (new_tdesc);
     }
 
-  return tdesc;
+  return tdesc.get ();
 }
index 7d27a5b7b2549f9af59df67870c4b96467939fe7..0805862ee7f98d7d06385af5fb95fc4d1a866472 100644 (file)
@@ -103,7 +103,7 @@ arc_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
   linux_set_pc_32bit (regcache, pc);
 }
 
-static const struct target_desc *
+static const_target_desc_up
 arc_linux_read_description (void)
 {
 #ifdef __ARC700__
@@ -116,13 +116,13 @@ arc_linux_read_description (void)
   static const char *expedite_regs[] = { "sp", "status32", nullptr };
   init_target_desc (tdesc.get (), expedite_regs, GDB_OSABI_LINUX);
 
-  return tdesc.release ();
+  return tdesc;
 }
 
 void
 arc_target::low_arch_setup ()
 {
-  current_process ()->tdesc = arc_linux_read_description ();
+  current_process ()->tdesc = arc_linux_read_description ().release ();
 }
 
 bool
index 2671f1206f0dbc6502cd6230e8fcb366df93a0d5..17ce57636f17d4d04b98d66a52e25d53a254cd3a 100644 (file)
 #include <inttypes.h>
 
 /* All possible Arm target descriptors.  */
-static struct target_desc *tdesc_arm_list[ARM_FP_TYPE_INVALID];
+static const_target_desc_up tdesc_arm_list[ARM_FP_TYPE_INVALID];
 
 /* See linux-arm-tdesc.h.  */
 
 const target_desc *
 arm_linux_read_description (arm_fp_type fp_type)
 {
-  struct target_desc *tdesc = tdesc_arm_list[fp_type];
+  const_target_desc_up &tdesc = tdesc_arm_list[fp_type];
 
   if (tdesc == nullptr)
     {
-      tdesc = arm_create_target_description (fp_type, false);
+      target_desc_up new_tdesc = arm_create_target_description (fp_type, false);
 
       static const char *expedite_regs[] = { "r11", "sp", "pc", 0 };
-      init_target_desc (tdesc, expedite_regs, GDB_OSABI_LINUX);
+      init_target_desc (new_tdesc.get (), expedite_regs, GDB_OSABI_LINUX);
 
-      tdesc_arm_list[fp_type] = tdesc;
+      tdesc = std::move (new_tdesc);
     }
 
-  return tdesc;
+  return tdesc.get ();
 }
 
 /* See linux-arm-tdesc.h.  */
@@ -56,7 +56,7 @@ arm_linux_get_tdesc_fp_type (const target_desc *tdesc)
      is ok, because tdesc must be one of the initialised ones.  */
   for (int i = ARM_FP_TYPE_NONE; i < ARM_FP_TYPE_INVALID; i++)
     {
-      if (tdesc == tdesc_arm_list[i])
+      if (tdesc == tdesc_arm_list[i].get ())
        return (arm_fp_type) i;
     }
 
index 66e394018ce3efdb07648328bec50d32eb9cb46b..b97db9c85870ba807e26efabef05deaf6058d5ca 100644 (file)
@@ -177,51 +177,51 @@ get_ipa_tdesc (int idx)
     {
 #ifdef __powerpc64__
     case PPC_TDESC_BASE:
-      return tdesc_powerpc_64l;
+      return tdesc_powerpc_64l.get ();
     case PPC_TDESC_ALTIVEC:
-      return tdesc_powerpc_altivec64l;
+      return tdesc_powerpc_altivec64l.get ();
     case PPC_TDESC_VSX:
-      return tdesc_powerpc_vsx64l;
+      return tdesc_powerpc_vsx64l.get ();
     case PPC_TDESC_ISA205:
-      return tdesc_powerpc_isa205_64l;
+      return tdesc_powerpc_isa205_64l.get ();
     case PPC_TDESC_ISA205_ALTIVEC:
-      return tdesc_powerpc_isa205_altivec64l;
+      return tdesc_powerpc_isa205_altivec64l.get ();
     case PPC_TDESC_ISA205_VSX:
-      return tdesc_powerpc_isa205_vsx64l;
+      return tdesc_powerpc_isa205_vsx64l.get ();
     case PPC_TDESC_ISA205_PPR_DSCR_VSX:
-      return tdesc_powerpc_isa205_ppr_dscr_vsx64l;
+      return tdesc_powerpc_isa205_ppr_dscr_vsx64l.get ();
     case PPC_TDESC_ISA207_VSX:
-      return tdesc_powerpc_isa207_vsx64l;
+      return tdesc_powerpc_isa207_vsx64l.get ();
     case PPC_TDESC_ISA207_HTM_VSX:
-      return tdesc_powerpc_isa207_htm_vsx64l;
+      return tdesc_powerpc_isa207_htm_vsx64l.get ();
 #else
     case PPC_TDESC_BASE:
-      return tdesc_powerpc_32l;
+      return tdesc_powerpc_32l.get ();
     case PPC_TDESC_ALTIVEC:
-      return tdesc_powerpc_altivec32l;
+      return tdesc_powerpc_altivec32l.get ();
     case PPC_TDESC_VSX:
-      return tdesc_powerpc_vsx32l;
+      return tdesc_powerpc_vsx32l.get ();
     case PPC_TDESC_ISA205:
-      return tdesc_powerpc_isa205_32l;
+      return tdesc_powerpc_isa205_32l.get ();
     case PPC_TDESC_ISA205_ALTIVEC:
-      return tdesc_powerpc_isa205_altivec32l;
+      return tdesc_powerpc_isa205_altivec32l.get ();
     case PPC_TDESC_ISA205_VSX:
-      return tdesc_powerpc_isa205_vsx32l;
+      return tdesc_powerpc_isa205_vsx32l.get ();
     case PPC_TDESC_ISA205_PPR_DSCR_VSX:
-      return tdesc_powerpc_isa205_ppr_dscr_vsx32l;
+      return tdesc_powerpc_isa205_ppr_dscr_vsx32l.get ();
     case PPC_TDESC_ISA207_VSX:
-      return tdesc_powerpc_isa207_vsx32l;
+      return tdesc_powerpc_isa207_vsx32l.get ();
     case PPC_TDESC_ISA207_HTM_VSX:
-      return tdesc_powerpc_isa207_htm_vsx32l;
+      return tdesc_powerpc_isa207_htm_vsx32l.get ();
     case PPC_TDESC_E500:
-      return tdesc_powerpc_e500l;
+      return tdesc_powerpc_e500l.get ();
 #endif
     default:
       internal_error ("unknown ipa tdesc index: %d", idx);
 #ifdef __powerpc64__
-      return tdesc_powerpc_64l;
+      return tdesc_powerpc_64l.get ();
 #else
-      return tdesc_powerpc_32l;
+      return tdesc_powerpc_32l.get ();
 #endif
     }
 }
index dc8a48b763a41c13cdedbf8bd90f25b001f3593d..0590f57b24a5c039703c8b711c132fdc207383cb 100644 (file)
@@ -884,9 +884,9 @@ ppc_target::low_arch_setup ()
   features.wordsize = ppc_linux_target_wordsize (tid);
 
   if (features.wordsize == 4)
-      tdesc = tdesc_powerpc_32l;
+      tdesc = tdesc_powerpc_32l.get ();
   else
-      tdesc = tdesc_powerpc_64l;
+      tdesc = tdesc_powerpc_64l.get ();
 
   current_process ()->tdesc = tdesc;
 
@@ -932,7 +932,7 @@ ppc_target::low_arch_setup ()
      Set the low target's regmap field as appropriately.  */
 #ifndef __powerpc64__
   if (ppc_hwcap & PPC_FEATURE_HAS_SPE)
-    tdesc = tdesc_powerpc_e500l;
+    tdesc = tdesc_powerpc_e500l.get ();
 
   if (!ppc_regmap_adjusted)
     {
@@ -3397,45 +3397,45 @@ ppc_target::get_ipa_tdesc_idx ()
   const target_desc *tdesc = current_process ()->tdesc;
 
 #ifdef __powerpc64__
-  if (tdesc == tdesc_powerpc_64l)
+  if (tdesc == tdesc_powerpc_64l.get ())
     return PPC_TDESC_BASE;
-  if (tdesc == tdesc_powerpc_altivec64l)
+  if (tdesc == tdesc_powerpc_altivec64l.get ())
     return PPC_TDESC_ALTIVEC;
-  if (tdesc == tdesc_powerpc_vsx64l)
+  if (tdesc == tdesc_powerpc_vsx64l.get ())
     return PPC_TDESC_VSX;
-  if (tdesc == tdesc_powerpc_isa205_64l)
+  if (tdesc == tdesc_powerpc_isa205_64l.get ())
     return PPC_TDESC_ISA205;
-  if (tdesc == tdesc_powerpc_isa205_altivec64l)
+  if (tdesc == tdesc_powerpc_isa205_altivec64l.get ())
     return PPC_TDESC_ISA205_ALTIVEC;
-  if (tdesc == tdesc_powerpc_isa205_vsx64l)
+  if (tdesc == tdesc_powerpc_isa205_vsx64l.get ())
     return PPC_TDESC_ISA205_VSX;
-  if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx64l)
+  if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx64l.get ())
     return PPC_TDESC_ISA205_PPR_DSCR_VSX;
-  if (tdesc == tdesc_powerpc_isa207_vsx64l)
+  if (tdesc == tdesc_powerpc_isa207_vsx64l.get ())
     return PPC_TDESC_ISA207_VSX;
-  if (tdesc == tdesc_powerpc_isa207_htm_vsx64l)
+  if (tdesc == tdesc_powerpc_isa207_htm_vsx64l.get ())
     return PPC_TDESC_ISA207_HTM_VSX;
 #endif
 
-  if (tdesc == tdesc_powerpc_32l)
+  if (tdesc == tdesc_powerpc_32l.get ())
     return PPC_TDESC_BASE;
-  if (tdesc == tdesc_powerpc_altivec32l)
+  if (tdesc == tdesc_powerpc_altivec32l.get ())
     return PPC_TDESC_ALTIVEC;
-  if (tdesc == tdesc_powerpc_vsx32l)
+  if (tdesc == tdesc_powerpc_vsx32l.get ())
     return PPC_TDESC_VSX;
-  if (tdesc == tdesc_powerpc_isa205_32l)
+  if (tdesc == tdesc_powerpc_isa205_32l.get ())
     return PPC_TDESC_ISA205;
-  if (tdesc == tdesc_powerpc_isa205_altivec32l)
+  if (tdesc == tdesc_powerpc_isa205_altivec32l.get ())
     return PPC_TDESC_ISA205_ALTIVEC;
-  if (tdesc == tdesc_powerpc_isa205_vsx32l)
+  if (tdesc == tdesc_powerpc_isa205_vsx32l.get ())
     return PPC_TDESC_ISA205_VSX;
-  if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx32l)
+  if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx32l.get ())
     return PPC_TDESC_ISA205_PPR_DSCR_VSX;
-  if (tdesc == tdesc_powerpc_isa207_vsx32l)
+  if (tdesc == tdesc_powerpc_isa207_vsx32l.get ())
     return PPC_TDESC_ISA207_VSX;
-  if (tdesc == tdesc_powerpc_isa207_htm_vsx32l)
+  if (tdesc == tdesc_powerpc_isa207_htm_vsx32l.get ())
     return PPC_TDESC_ISA207_HTM_VSX;
-  if (tdesc == tdesc_powerpc_e500l)
+  if (tdesc == tdesc_powerpc_e500l.get ())
     return PPC_TDESC_E500;
 
   return 0;
index 810a8148bd4501cf90ef16413260f46d8730ac8b..9281b78f127b28123aed2f6570ee3296d62c2de0 100644 (file)
@@ -209,17 +209,18 @@ static struct usrregs_info tic6x_usrregs_info =
 static const struct target_desc *
 tic6x_read_description (enum c6x_feature feature)
 {
-  static target_desc *tdescs[C6X_LAST] = { };
-  struct target_desc **tdesc = &tdescs[feature];
+  static const_target_desc_up tdescs[C6X_LAST];
+  const_target_desc_up &tdesc = &tdescs[feature];
 
-  if (*tdesc == NULL)
+  if (tdesc == nullptr)
     {
-      *tdesc = tic6x_create_target_description (feature);
+      target_desc_up new_tdesc = tic6x_create_target_description (feature);
       static const char *expedite_regs[] = { "A15", "PC", NULL };
-      init_target_desc (*tdesc, expedite_regs, GDB_OSABI_LINUX);
+      init_target_desc (new_tdesc.get (), expedite_regs, GDB_OSABI_LINUX);
+      tdesc = std::move (new_tdesc);
     }
 
-  return *tdesc;
+  return tdesc->get ();
 }
 
 bool
index 90f136dc7dfca094c4cad71823c217990d87f2a3..172af5be212d51c30533cae603b14195aae21274 100644 (file)
@@ -94,13 +94,12 @@ netbsd_aarch64_target::get_regs_info ()
 void
 netbsd_aarch64_target::low_arch_setup ()
 {
-  target_desc *tdesc
-    = aarch64_create_target_description ({});
+  target_desc_up tdesc = aarch64_create_target_description ({});
 
   static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL };
-  init_target_desc (tdesc, expedite_regs_aarch64, GDB_OSABI_NETBSD);
+  init_target_desc (tdesc.get (), expedite_regs_aarch64, GDB_OSABI_NETBSD);
 
-  current_process ()->tdesc = tdesc;
+  current_process ()->tdesc = tdesc.release ();
 }
 
 /* The singleton target ops object.  */
index c99393aae4b99d2e17a7396d89a04663ab98102d..8e19c59715b81aacd7d14b08448e7d185dc092c4 100644 (file)
@@ -190,12 +190,12 @@ netbsd_amd64_target::get_regs_info ()
 void
 netbsd_amd64_target::low_arch_setup ()
 {
-  target_desc *tdesc
+  target_desc_up tdesc
     = amd64_create_target_description (X86_XSTATE_SSE_MASK, false, false, false);
 
-  init_target_desc (tdesc, amd64_expedite_regs, GDB_OSABI_NETBSD);
+  init_target_desc (tdesc.get (), amd64_expedite_regs, GDB_OSABI_NETBSD);
 
-  current_process ()->tdesc = tdesc;
+  current_process ()->tdesc = tdesc.release ();
 }
 
 /* The singleton target ops object.  */
index d9e2ef78622f4eb66298f04d761d830772e8da0b..925869621340d49b5ea3de4f7f8fc8a7d8073162 100644 (file)
@@ -139,12 +139,12 @@ netbsd_i386_target::get_regs_info ()
 void
 netbsd_i386_target::low_arch_setup ()
 {
-  target_desc *tdesc
+  target_desc_up tdesc
     = i386_create_target_description (X86_XSTATE_SSE_MASK, false, false);
 
-  init_target_desc (tdesc, i386_expedite_regs, GDB_OSABI_NETBSD);
+  init_target_desc (tdesc.get (), i386_expedite_regs, GDB_OSABI_NETBSD);
 
-  current_process ()->tdesc = tdesc;
+  current_process ()->tdesc = tdesc.release ();
 }
 
 /* The singleton target ops object.  */
index 54c105c54eca11b5dfd30a74260ec8af5de3417e..59698159f656dcaa8d9cf1123ce9d294ed19eb72 100644 (file)
@@ -105,7 +105,7 @@ allocate_target_description (void)
 /* See gdbsupport/tdesc.h.  */
 
 void
-target_desc_deleter::operator() (struct target_desc *target_desc) const
+target_desc_deleter::operator() (const target_desc *target_desc) const
 {
   delete target_desc;
 }
index 26de2ecc42fb78e636e2c738756a0e21143fc6b8..565b42377a4a22ae2eb8b36916216e7b20f5c1ac 100644 (file)
@@ -541,21 +541,21 @@ static const unsigned char i386_win32_breakpoint = 0xcc;
 static void
 i386_arch_setup (void)
 {
 struct target_desc *tdesc;
target_desc_up tdesc;
 
 #ifdef __x86_64__
   tdesc = amd64_create_target_description (X86_XSTATE_SSE_MASK, false,
                                           false, false);
-  init_target_desc (tdesc, amd64_expedite_regs, WINDOWS_OSABI);
-  win32_tdesc = tdesc;
+  init_target_desc (tdesc.get (), amd64_expedite_regs, WINDOWS_OSABI);
+  win32_tdesc = std::move (tdesc);
 #endif
 
   tdesc = i386_create_target_description (X86_XSTATE_SSE_MASK, false, false);
-  init_target_desc (tdesc, i386_expedite_regs, WINDOWS_OSABI);
+  init_target_desc (tdesc.get (), i386_expedite_regs, WINDOWS_OSABI);
 #ifdef __x86_64__
-  wow64_win32_tdesc = tdesc;
+  wow64_win32_tdesc = std::move (tdesc);
 #else
-  win32_tdesc = tdesc;
+  win32_tdesc = std::move (tdesc);
 #endif
 }
 
index 635479b638cd24bc0cb339a759f72918dc4bd6c2..770c9a373570063a82782507df9f6d9c1b99837c 100644 (file)
@@ -62,9 +62,9 @@ gdbserver_windows_process windows_process;
 
 int using_threads = 1;
 
-const struct target_desc *win32_tdesc;
+const_target_desc_up win32_tdesc;
 #ifdef __x86_64__
-const struct target_desc *wow64_win32_tdesc;
+const_target_desc_up wow64_win32_tdesc;
 #endif
 
 #define NUM_REGS (the_low_target.num_regs ())
@@ -326,10 +326,10 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
   proc = add_process (pid, attached);
 #ifdef __x86_64__
   if (windows_process.wow64_process)
-    proc->tdesc = wow64_win32_tdesc;
+    proc->tdesc = wow64_win32_tdesc.get ();
   else
 #endif
-    proc->tdesc = win32_tdesc;
+    proc->tdesc = win32_tdesc.get ();
   child_init_thread_list ();
   windows_process.child_initialization_done = 0;
 
index 680ae2bb344939d7832f55e68c10f75efd18a9c8..a96875e7098bf75b9d8b4e9011a4e6e291bb21da 100644 (file)
@@ -20,6 +20,7 @@
 #define GDBSERVER_WIN32_LOW_H
 
 #include <windows.h>
+#include "gdbsupport/tdesc.h"
 #include "nat/windows-nat.h"
 #include "gdbsupport/osabi.h"
 
@@ -27,9 +28,9 @@ struct target_desc;
 
 /* The inferior's target description.  This is a global because the
    Windows ports support neither bi-arch nor multi-process.  */
-extern const struct target_desc *win32_tdesc;
+extern const_target_desc_up win32_tdesc;
 #ifdef __x86_64__
-extern const struct target_desc *wow64_win32_tdesc;
+extern const_target_desc_up wow64_win32_tdesc;
 #endif
 
 #ifdef __CYGWIN__
index 6bf66ad3dcdcb9148fddf3a462bad2c0ce549ab7..a54cc3951969c145dbd382c0a2fe1f11fd32f36a 100644 (file)
@@ -322,12 +322,14 @@ typedef std::unique_ptr<tdesc_feature> tdesc_feature_up;
 
 struct target_desc_deleter
 {
-  void operator() (struct target_desc *desc) const;
+  void operator() (const target_desc *desc) const;
 };
 
 /* A unique pointer specialization that holds a target_desc.  */
 
-typedef std::unique_ptr<target_desc, target_desc_deleter> target_desc_up;
+using target_desc_up = std::unique_ptr<target_desc, target_desc_deleter>;
+using const_target_desc_up
+  = std::unique_ptr<const target_desc, target_desc_deleter>;
 
 /* Allocate a new target_desc.  */
 target_desc_up allocate_target_description (void);