aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-aix.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/solib-aix.c')
-rw-r--r--gdb/solib-aix.c94
1 files changed, 34 insertions, 60 deletions
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 926f1ed..b246df8 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,6 @@
#include "solib-aix.h"
#include "solib.h"
-#include "solist.h"
#include "inferior.h"
#include "gdb_bfd.h"
#include "objfiles.h"
@@ -25,6 +24,24 @@
#include "xcoffread.h"
#include "observable.h"
+/* solib_ops for AIX systems. */
+
+struct aix_solib_ops : public solib_ops
+{
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void create_inferior_hook (int from_tty) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ gdb_bfd_ref_ptr bfd_open (const char *pathname) const override;
+};
+
+/* See solib-aix.h. */
+
+solib_ops_up
+make_aix_solib_ops ()
+{
+ return std::make_unique<aix_solib_ops> ();
+}
+
/* Our private data in struct solib. */
struct lm_info_aix final : public lm_info
@@ -307,10 +324,9 @@ solib_aix_bss_data_overlap (bfd *abfd)
return 0;
}
-/* Implement the "relocate_section_addresses" solib_ops method. */
-
-static void
-solib_aix_relocate_section_addresses (solib &so, target_section *sec)
+void
+aix_solib_ops::relocate_section_addresses (solib &so,
+ target_section *sec) const
{
struct bfd_section *bfd_sect = sec->the_bfd_section;
bfd *abfd = bfd_sect->owner;
@@ -411,10 +427,8 @@ solib_aix_get_section_offsets (struct objfile *objfile,
return offsets;
}
-/* Implement the "solib_create_inferior_hook" solib_ops method. */
-
-static void
-solib_aix_solib_create_inferior_hook (int from_tty)
+void
+aix_solib_ops::create_inferior_hook (int from_tty) const
{
const char *warning_msg = "unable to relocate main executable";
@@ -442,10 +456,8 @@ solib_aix_solib_create_inferior_hook (int from_tty)
}
}
-/* Implement the "current_sos" solib_ops method. */
-
-static owning_intrusive_list<solib>
-solib_aix_current_sos ()
+owning_intrusive_list<solib>
+aix_solib_ops::current_sos () const
{
std::optional<std::vector<lm_info_aix>> &library_list
= solib_aix_get_library_list (current_inferior (), NULL);
@@ -481,35 +493,17 @@ solib_aix_current_sos ()
}
/* Add it to the list. */
- auto &new_solib = sos.emplace_back ();
- new_solib.so_original_name = so_name;
- new_solib.so_name = so_name;
+ auto &new_solib = sos.emplace_back (*this);
+ new_solib.original_name = so_name;
+ new_solib.name = so_name;
new_solib.lm_info = std::make_unique<lm_info_aix> (info);
}
return sos;
}
-/* Implement the "open_symbol_file_object" solib_ops method. */
-
-static int
-solib_aix_open_symbol_file_object (int from_tty)
-{
- return 0;
-}
-
-/* Implement the "in_dynsym_resolve_code" solib_ops method. */
-
-static int
-solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
-{
- return 0;
-}
-
-/* Implement the "bfd_open" solib_ops method. */
-
-static gdb_bfd_ref_ptr
-solib_aix_bfd_open (const char *pathname)
+gdb_bfd_ref_ptr
+aix_solib_ops::bfd_open (const char *pathname) const
{
/* The pathname is actually a synthetic filename with the following
form: "/path/to/sharedlib(member.o)" (double-quotes excluded).
@@ -523,7 +517,7 @@ solib_aix_bfd_open (const char *pathname)
int found_file;
if (pathname[path_len - 1] != ')')
- return solib_bfd_open (pathname);
+ return solib_ops::bfd_open (pathname);
/* Search for the associated parens. */
sep = strrchr (pathname, '(');
@@ -533,7 +527,7 @@ solib_aix_bfd_open (const char *pathname)
to open pathname without decoding, possibly leading to
a failure), rather than triggering an assert failure). */
warning (_("missing '(' in shared object pathname: %s"), pathname);
- return solib_bfd_open (pathname);
+ return solib_ops::bfd_open (pathname);
}
filename_len = sep - pathname;
@@ -676,27 +670,7 @@ solib_aix_normal_stop_observer (struct bpstat *unused_1, int unused_2)
data->library_list.reset ();
}
-/* The solib_ops for AIX targets. */
-const solib_ops solib_aix_so_ops =
-{
- solib_aix_relocate_section_addresses,
- nullptr,
- nullptr,
- solib_aix_solib_create_inferior_hook,
- solib_aix_current_sos,
- solib_aix_open_symbol_file_object,
- solib_aix_in_dynsym_resolve_code,
- solib_aix_bfd_open,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- default_find_solib_addr,
-};
-
-void _initialize_solib_aix ();
-void
-_initialize_solib_aix ()
+INIT_GDB_FILE (solib_aix)
{
gdb::observers::normal_stop.attach (solib_aix_normal_stop_observer,
"solib-aix");