mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 00:59:15 +08:00
gdb: change inferior::tdesc_info to non-pointer
I initially made this field a unique pointer, to have automatic memory management. But I then thought that the field didn't really need to be allocated separately from struct inferior. So make it a regular non-pointer field of inferior. Remove target_desc_info_free, as it's no longer needed. Change-Id: Ica2b97071226f31c40e86222a2f6922454df1229
This commit is contained in:

committed by
Simon Marchi

parent
650160322c
commit
79846903c6
@ -69,8 +69,6 @@ private_inferior::~private_inferior () = default;
|
|||||||
|
|
||||||
inferior::~inferior ()
|
inferior::~inferior ()
|
||||||
{
|
{
|
||||||
inferior *inf = this;
|
|
||||||
|
|
||||||
/* Before the inferior is deleted, all target_ops should be popped from
|
/* Before the inferior is deleted, all target_ops should be popped from
|
||||||
the target stack, this leaves just the dummy_target behind. If this
|
the target stack, this leaves just the dummy_target behind. If this
|
||||||
is not done, then any target left in the target stack will be left
|
is not done, then any target left in the target stack will be left
|
||||||
@ -81,7 +79,6 @@ inferior::~inferior ()
|
|||||||
gdb_assert (m_target_stack.top ()->stratum () == dummy_stratum);
|
gdb_assert (m_target_stack.top ()->stratum () == dummy_stratum);
|
||||||
|
|
||||||
m_continuations.clear ();
|
m_continuations.clear ();
|
||||||
target_desc_info_free (inf->tdesc_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inferior::inferior (int pid_)
|
inferior::inferior (int pid_)
|
||||||
@ -964,7 +961,7 @@ clone_inferior_command (const char *args, int from_tty)
|
|||||||
|
|
||||||
/* If the original inferior had a user specified target
|
/* If the original inferior had a user specified target
|
||||||
description, make the clone use it too. */
|
description, make the clone use it too. */
|
||||||
if (target_desc_info_from_user_p (inf->tdesc_info))
|
if (target_desc_info_from_user_p (&inf->tdesc_info))
|
||||||
copy_inferior_target_desc_info (inf, orginf);
|
copy_inferior_target_desc_info (inf, orginf);
|
||||||
|
|
||||||
clone_program_space (pspace, orginf->pspace);
|
clone_program_space (pspace, orginf->pspace);
|
||||||
|
@ -633,7 +633,7 @@ public:
|
|||||||
|
|
||||||
/* Info about an inferior's target description (if it's fetched; the
|
/* Info about an inferior's target description (if it's fetched; the
|
||||||
user supplied description's filename, if any; etc.). */
|
user supplied description's filename, if any; etc.). */
|
||||||
target_desc_info *tdesc_info = NULL;
|
target_desc_info tdesc_info;
|
||||||
|
|
||||||
/* The architecture associated with the inferior through the
|
/* The architecture associated with the inferior through the
|
||||||
connection to the target.
|
connection to the target.
|
||||||
|
@ -436,16 +436,12 @@ struct tdesc_arch_data
|
|||||||
gdbarch_register_reggroup_p_ftype *pseudo_register_reggroup_p = NULL;
|
gdbarch_register_reggroup_p_ftype *pseudo_register_reggroup_p = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get the inferior INF's target description info, allocating one on
|
/* Get the inferior INF's target description info. */
|
||||||
the stop if necessary. */
|
|
||||||
|
|
||||||
static struct target_desc_info *
|
static struct target_desc_info *
|
||||||
get_tdesc_info (struct inferior *inf)
|
get_tdesc_info (struct inferior *inf)
|
||||||
{
|
{
|
||||||
if (inf->tdesc_info == NULL)
|
return &inf->tdesc_info;
|
||||||
inf->tdesc_info = new target_desc_info;
|
|
||||||
|
|
||||||
return inf->tdesc_info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A handle for architecture-specific data associated with the
|
/* A handle for architecture-specific data associated with the
|
||||||
@ -482,14 +478,6 @@ copy_inferior_target_desc_info (struct inferior *destinf, struct inferior *srcin
|
|||||||
*dest = *src;
|
*dest = *src;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See target-descriptions.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
target_desc_info_free (struct target_desc_info *tdesc_info)
|
|
||||||
{
|
|
||||||
delete tdesc_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The string manipulated by the "set tdesc filename ..." command. */
|
/* The string manipulated by the "set tdesc filename ..." command. */
|
||||||
|
|
||||||
static std::string tdesc_filename_cmd_string;
|
static std::string tdesc_filename_cmd_string;
|
||||||
|
@ -55,10 +55,6 @@ const struct target_desc *target_current_description (void);
|
|||||||
void copy_inferior_target_desc_info (struct inferior *destinf,
|
void copy_inferior_target_desc_info (struct inferior *destinf,
|
||||||
struct inferior *srcinf);
|
struct inferior *srcinf);
|
||||||
|
|
||||||
/* Free a target_desc_info object. */
|
|
||||||
|
|
||||||
void target_desc_info_free (struct target_desc_info *tdesc_info);
|
|
||||||
|
|
||||||
/* Returns true if INFO indicates the target description had been
|
/* Returns true if INFO indicates the target description had been
|
||||||
supplied by the user. */
|
supplied by the user. */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user