]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/mips: make mips_tdesc_gp{32,64} target_desc_up
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 10 Nov 2025 17:40:29 +0000 (12:40 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 11 Nov 2025 15:47:25 +0000 (10:47 -0500)
Change the types to target_desc_up so it's not needed to `.release()`
them.  This is similar to this review comment:

https: //inbox.sourceware.org/gdb-patches/87seeuak0z.fsf@tromey.com/

Change-Id: I45e0e77b00701aa979e8f7f15f397836b4e19849
Approved-By: Maciej W. Rozycki <macro@orcam.me.uk>
Tested-By: Maciej W. Rozycki <macro@orcam.me.uk>
gdb/mips-linux-tdep.c
gdb/mips-tdep.c
gdb/mips-tdep.h

index b668bcb357815d6a4fb443fc17a807f99e9cd783..cec0ddd6b4d261d765b2eec67caec4e91354704d 100644 (file)
@@ -565,10 +565,10 @@ mips_linux_core_read_description (struct gdbarch *gdbarch,
   switch (bfd_section_size (section))
     {
     case sizeof (mips_elf_gregset_t):
-      return mips_tdesc_gp32;
+      return mips_tdesc_gp32.get ();
 
     case sizeof (mips64_elf_gregset_t):
-      return mips_tdesc_gp64;
+      return mips_tdesc_gp64.get ();
 
     default:
       return NULL;
index d072b9a4d3398cb02b47f82aab382de563062e04..2bd2db0bc771f24a8cf407ff37e2b9e71c458b72 100644 (file)
@@ -209,8 +209,8 @@ static unsigned int mips_debug = 0;
 #define PROPERTY_GP32 "internal: transfers-32bit-registers"
 #define PROPERTY_GP64 "internal: transfers-64bit-registers"
 
-struct target_desc *mips_tdesc_gp32;
-struct target_desc *mips_tdesc_gp64;
+target_desc_up mips_tdesc_gp32;
+target_desc_up mips_tdesc_gp64;
 
 /* The current set of options to be passed to the disassembler.  */
 static std::string mips_disassembler_options;
@@ -8057,14 +8057,14 @@ mips_register_g_packet_guesses (struct gdbarch *gdbarch)
 {
   /* If the size matches the set of 32-bit or 64-bit integer registers,
      assume that's what we've got.  */
-  register_remote_g_packet_guess (gdbarch, 38 * 4, mips_tdesc_gp32);
-  register_remote_g_packet_guess (gdbarch, 38 * 8, mips_tdesc_gp64);
+  register_remote_g_packet_guess (gdbarch, 38 * 4, mips_tdesc_gp32.get ());
+  register_remote_g_packet_guess (gdbarch, 38 * 8, mips_tdesc_gp64.get ());
 
   /* If the size matches the full set of registers GDB traditionally
      knows about, including floating point, for either 32-bit or
      64-bit, assume that's what we've got.  */
-  register_remote_g_packet_guess (gdbarch, 90 * 4, mips_tdesc_gp32);
-  register_remote_g_packet_guess (gdbarch, 90 * 8, mips_tdesc_gp64);
+  register_remote_g_packet_guess (gdbarch, 90 * 4, mips_tdesc_gp32.get ());
+  register_remote_g_packet_guess (gdbarch, 90 * 8, mips_tdesc_gp64.get ());
 
   /* Otherwise we don't have a useful guess.  */
 }
@@ -8985,11 +8985,11 @@ INIT_GDB_FILE (mips_tdep)
 
   /* Create feature sets with the appropriate properties.  The values
      are not important.  */
-  mips_tdesc_gp32 = allocate_target_description ().release ();
-  set_tdesc_property (mips_tdesc_gp32, PROPERTY_GP32, "");
+  mips_tdesc_gp32 = allocate_target_description ();
+  set_tdesc_property (mips_tdesc_gp32.get (), PROPERTY_GP32, "");
 
-  mips_tdesc_gp64 = allocate_target_description ().release ();
-  set_tdesc_property (mips_tdesc_gp64, PROPERTY_GP64, "");
+  mips_tdesc_gp64 = allocate_target_description ();
+  set_tdesc_property (mips_tdesc_gp64.get (), PROPERTY_GP64, "");
 
   /* Add root prefix command for all "set mips"/"show mips" commands.  */
   add_setshow_prefix_cmd ("mips", no_class,
index f9effb054fa260364105563aad85c4001262e222..ee1f44175546e3acc22f9baf979ff38772a4b852 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef GDB_MIPS_TDEP_H
 #define GDB_MIPS_TDEP_H
 
+#include "gdbsupport/tdesc.h"
 #include "objfiles.h"
 #include "gdbarch.h"
 
@@ -190,8 +191,8 @@ extern void mips_write_pc (struct regcache *regcache, CORE_ADDR pc);
 
 /* Target descriptions which only indicate the size of general
    registers.  */
-extern struct target_desc *mips_tdesc_gp32;
-extern struct target_desc *mips_tdesc_gp64;
+extern target_desc_up mips_tdesc_gp32;
+extern target_desc_up mips_tdesc_gp64;
 
 /* Return non-zero if PC is in a MIPS SVR4 lazy binding stub section.  */