/* Our private data in struct so_list. */
-struct lm_info_aix : public lm_info
+struct lm_info_aix final : public lm_info
{
/* The name of the file mapped by the loader. Apart from the entry
for the main executable, this is usually a shared library (which,
}
}
-/* Implement the "free_so" target_so_ops method. */
-
-static void
-solib_aix_free_so (so_list &so)
-{
- lm_info_aix *li = (lm_info_aix *) so.lm_info;
-
- solib_debug_printf ("%s", so.so_name);
-
- delete li;
-}
-
/* Compute and return the OBJFILE's section_offset array, using
the associated loader info (INFO). */
const struct target_so_ops solib_aix_so_ops =
{
solib_aix_relocate_section_addresses,
- solib_aix_free_so,
nullptr,
nullptr,
solib_aix_solib_create_inferior_hook,
/* Link map info to include in an allocated so_list entry. */
-struct lm_info_darwin : public lm_info
+struct lm_info_darwin final : public lm_info
{
/* The target location of lm. */
CORE_ADDR lm_addr = 0;
info->all_image.version = 0;
}
-static void
-darwin_free_so (so_list &so)
-{
- lm_info_darwin *li = (lm_info_darwin *) so.lm_info;
-
- delete li;
-}
-
/* The section table is built from bfd sections using bfd VMAs.
Relocate these VMAs according to solib info. */
const struct target_so_ops darwin_so_ops =
{
darwin_relocate_section_addresses,
- darwin_free_so,
nullptr,
darwin_clear_solib,
darwin_solib_create_inferior_hook,
/* Link map info to include in an allocated so_list entry */
-struct lm_info_dsbt : public lm_info
+struct lm_info_dsbt final : public lm_info
{
~lm_info_dsbt ()
{
info->main_executable_lm_info = NULL;
}
-static void
-dsbt_free_so (so_list &so)
-{
- lm_info_dsbt *li = (lm_info_dsbt *) so.lm_info;
-
- delete li;
-}
-
static void
dsbt_relocate_section_addresses (so_list &so, target_section *sec)
{
const struct target_so_ops dsbt_so_ops =
{
dsbt_relocate_section_addresses,
- dsbt_free_so,
nullptr,
dsbt_clear_solib,
dsbt_solib_create_inferior_hook,
/* Link map info to include in an allocated so_list entry. */
-struct lm_info_frv : public lm_info
+struct lm_info_frv final : public lm_info
{
~lm_info_frv ()
{
main_executable_lm_info = NULL;
}
-static void
-frv_free_so (so_list &so)
-{
- lm_info_frv *li = (lm_info_frv *) so.lm_info;
-
- delete li;
-}
-
static void
frv_relocate_section_addresses (so_list &so, target_section *sec)
{
const struct target_so_ops frv_so_ops =
{
frv_relocate_section_addresses,
- frv_free_so,
nullptr,
frv_clear_solib,
frv_solib_create_inferior_hook,
probes_table_remove_objfile_probes (objfile);
}
-/* Implementation for target_so_ops.free_so. */
-
-static void
-svr4_free_so (so_list &so)
-{
- lm_info_svr4 *li = (lm_info_svr4 *) so.lm_info;
-
- delete li;
-}
-
/* Implement target_so_ops.clear_so. */
static void
const struct target_so_ops svr4_so_ops =
{
svr4_relocate_section_addresses,
- svr4_free_so,
svr4_clear_so,
svr4_clear_solib,
svr4_solib_create_inferior_hook,
/* Link map info to include in an allocated so_list entry. */
-struct lm_info_svr4 : public lm_info
+struct lm_info_svr4 final : public lm_info
{
/* Amount by which addresses in the binary should be relocated to
match the inferior. The direct inferior value is L_ADDR_INFERIOR.
#include "inferior.h"
/* Private data for each loaded library. */
-struct lm_info_target : public lm_info
+struct lm_info_target final : public lm_info
{
/* The library's name. The name is normally kept in the struct
so_list; it is only here during XML parsing. */
/* Nothing needed. */
}
-static void
-solib_target_free_so (so_list &so)
-{
- lm_info_target *li = (lm_info_target *) so.lm_info;
-
- gdb_assert (li->name.empty ());
-
- delete li;
-}
-
static void
solib_target_relocate_section_addresses (so_list &so, target_section *sec)
{
const struct target_so_ops solib_target_so_ops =
{
solib_target_relocate_section_addresses,
- solib_target_free_so,
nullptr,
nullptr,
solib_target_solib_create_inferior_hook,
ops->clear_so (so);
}
+lm_info::~lm_info () = default;
+
/* Free the storage associated with the `struct so_list' object SO.
If we have opened a BFD for SO, close it.
void
free_so (so_list &so)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
clear_so (so);
- ops->free_so (so);
-
+ delete so.lm_info;
delete &so;
}
struct lm_info
{
+ lm_info () = default;
+ lm_info (const lm_info &) = default;
+ virtual ~lm_info () = 0;
};
struct so_list
which the object was actually mapped. */
void (*relocate_section_addresses) (so_list &so, target_section *);
- /* Free the link map info and any other private data structures
- associated with a so_list entry. */
- void (*free_so) (so_list &so);
-
/* Reset private data structures associated with SO.
This is called when SO is about to be reloaded.
- It is also called before free_so when SO is about to be freed. */
+ It is also called when SO is about to be freed. */
void (*clear_so) (const so_list &so);
/* Free private data structures associated to PSPACE. This method