gdb/mips: make mips_tdesc_gp{32,64} target_desc_up

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>
This commit is contained in:
Simon Marchi
2025-11-10 12:40:29 -05:00
parent 96b8a8a633
commit 330a0c4aaf
3 changed files with 15 additions and 14 deletions

View 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;

View 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,

View 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. */