[PATCH 2/2] gdb: rename target_so_ops to solib_ops
Simon Marchi
simon.marchi@efficios.com
Mon Feb 5 20:18:34 GMT 2024
I don't like the name `target_so_ops`, because:
- The name `target` is so overloaded, and in this case it's not even
related to target_ops or anything else called "target".
- We do have an implementation that actually fetches solibs from the
target (solib_target_so_op in solib-target.c), so it's confusing for
the "base class" to be called target_something as well.
Rename to solib_ops.
Change-Id: I46a983d44e81400470e22deb09aaf26ad8a3587f
---
gdb/frv-tdep.h | 4 +-
gdb/gdbarch-gen.h | 4 +-
gdb/gdbarch.c | 6 +-
gdb/gdbarch.h | 1 +
gdb/gdbarch_components.py | 2 +-
gdb/i386-nto-tdep.c | 2 +-
gdb/mips-linux-tdep.c | 2 +-
gdb/ppc-linux-tdep.c | 2 +-
gdb/solib-aix.c | 16 +-
gdb/solib-aix.h | 4 +-
gdb/solib-darwin.c | 2 +-
gdb/solib-darwin.h | 4 +-
gdb/solib-dsbt.c | 2 +-
gdb/solib-dsbt.h | 4 +-
gdb/solib-frv.c | 6 +-
gdb/solib-rocm.c | 2 +-
gdb/solib-svr4.c | 8 +-
gdb/solib-svr4.h | 4 +-
gdb/solib-target.c | 2 +-
gdb/solib-target.h | 4 +-
gdb/solib.c | 399 +++++++++++++++++++-------------------
gdb/solib.h | 2 +-
gdb/solist.h | 2 +-
gdb/windows-tdep.c | 4 +-
24 files changed, 243 insertions(+), 245 deletions(-)
diff --git a/gdb/frv-tdep.h b/gdb/frv-tdep.h
index d6128dd62715..95347ed224ed 100644
--- a/gdb/frv-tdep.h
+++ b/gdb/frv-tdep.h
@@ -118,7 +118,7 @@ CORE_ADDR frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point);
needed for TLS support. */
CORE_ADDR frv_fetch_objfile_link_map (struct objfile *objfile);
-struct target_so_ops;
-extern const struct target_so_ops frv_so_ops;
+struct solib_ops;
+extern const solib_ops frv_so_ops;
#endif /* FRV_TDEP_H */
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 383a53a62f47..7a57bdcebe23 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -785,8 +785,8 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s
/* Vtable of solib operations functions. */
-extern const struct target_so_ops * gdbarch_so_ops (struct gdbarch *gdbarch);
-extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const struct target_so_ops * so_ops);
+extern const solib_ops * gdbarch_so_ops (struct gdbarch *gdbarch);
+extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const solib_ops * so_ops);
/* If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
evaluates non-zero, this is the address where the debugger will place
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 153327124fda..b9be3948d1ee 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -154,7 +154,7 @@ struct gdbarch
gdbarch_single_step_through_delay_ftype *single_step_through_delay = nullptr;
gdbarch_print_insn_ftype *print_insn = default_print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code = generic_skip_trampoline_code;
- const struct target_so_ops * so_ops = &solib_target_so_ops;
+ const solib_ops * so_ops = &solib_target_so_ops;
gdbarch_skip_solib_resolver_ftype *skip_solib_resolver = generic_skip_solib_resolver;
gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline = generic_in_solib_return_trampoline;
gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk = default_in_indirect_branch_thunk;
@@ -3398,7 +3398,7 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
gdbarch->skip_trampoline_code = skip_trampoline_code;
}
-const struct target_so_ops *
+const solib_ops *
gdbarch_so_ops (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
@@ -3410,7 +3410,7 @@ gdbarch_so_ops (struct gdbarch *gdbarch)
void
set_gdbarch_so_ops (struct gdbarch *gdbarch,
- const struct target_so_ops * so_ops)
+ const solib_ops * so_ops)
{
gdbarch->so_ops = so_ops;
}
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index cabafbaa0be7..77d3406779ff 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -58,6 +58,7 @@ struct thread_info;
struct ui_out;
struct inferior;
struct x86_xsave_layout;
+struct solib_ops;
#include "regcache.h"
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index 9791bc07581c..d76b820c1b55 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -1383,7 +1383,7 @@ Function(
Value(
comment="Vtable of solib operations functions.",
- type="const struct target_so_ops *",
+ type="const solib_ops *",
name="so_ops",
predefault="&solib_target_so_ops",
printer="host_address_to_string (gdbarch->so_ops)",
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 0d05d65bf3bd..5e959df4df36 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -316,7 +316,7 @@ static void
i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
- static struct target_so_ops nto_svr4_so_ops;
+ static solib_ops nto_svr4_so_ops;
/* Deal with our strange signals. */
nto_initialize_signals ();
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 74411cdf43f4..9ecf698113b1 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -46,7 +46,7 @@
#include "features/mips64-linux.c"
#include "features/mips64-dsp-linux.c"
-static struct target_so_ops mips_svr4_so_ops;
+static solib_ops mips_svr4_so_ops;
/* This enum represents the signals' numbers on the MIPS
architecture. It just contains the signal definitions which are
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index aa1b3b908f7d..a7c1104b29f4 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -87,7 +87,7 @@
#include "dwarf2/frame.h"
/* Shared library operations for PowerPC-Linux. */
-static struct target_so_ops powerpc_so_ops;
+static solib_ops powerpc_so_ops;
/* The syscall's XML filename for PPC and PPC64. */
#define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml"
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 70bfe258e678..8c8f219bdc59 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -308,7 +308,7 @@ solib_aix_bss_data_overlap (bfd *abfd)
return 0;
}
-/* Implement the "relocate_section_addresses" target_so_ops method. */
+/* Implement the "relocate_section_addresses" solib_ops method. */
static void
solib_aix_relocate_section_addresses (solib &so, target_section *sec)
@@ -412,7 +412,7 @@ solib_aix_get_section_offsets (struct objfile *objfile,
return offsets;
}
-/* Implement the "solib_create_inferior_hook" target_so_ops method. */
+/* Implement the "solib_create_inferior_hook" solib_ops method. */
static void
solib_aix_solib_create_inferior_hook (int from_tty)
@@ -443,7 +443,7 @@ solib_aix_solib_create_inferior_hook (int from_tty)
}
}
-/* Implement the "current_sos" target_so_ops method. */
+/* Implement the "current_sos" solib_ops method. */
static intrusive_list<solib>
solib_aix_current_sos ()
@@ -493,7 +493,7 @@ solib_aix_current_sos ()
return sos;
}
-/* Implement the "open_symbol_file_object" target_so_ops method. */
+/* Implement the "open_symbol_file_object" solib_ops method. */
static int
solib_aix_open_symbol_file_object (int from_tty)
@@ -501,7 +501,7 @@ solib_aix_open_symbol_file_object (int from_tty)
return 0;
}
-/* Implement the "in_dynsym_resolve_code" target_so_ops method. */
+/* Implement the "in_dynsym_resolve_code" solib_ops method. */
static int
solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
@@ -509,7 +509,7 @@ solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
return 0;
}
-/* Implement the "bfd_open" target_so_ops method. */
+/* Implement the "bfd_open" solib_ops method. */
static gdb_bfd_ref_ptr
solib_aix_bfd_open (const char *pathname)
@@ -679,8 +679,8 @@ solib_aix_normal_stop_observer (struct bpstat *unused_1, int unused_2)
data->library_list.reset ();
}
-/* The target_so_ops for AIX targets. */
-const struct target_so_ops solib_aix_so_ops =
+/* The solib_ops for AIX targets. */
+const solib_ops solib_aix_so_ops =
{
solib_aix_relocate_section_addresses,
nullptr,
diff --git a/gdb/solib-aix.h b/gdb/solib-aix.h
index d47afb30e24b..6487460b04c3 100644
--- a/gdb/solib-aix.h
+++ b/gdb/solib-aix.h
@@ -18,8 +18,8 @@
#ifndef SOLIB_AIX_H
#define SOLIB_AIX_H
-struct target_so_ops;
-extern const struct target_so_ops solib_aix_so_ops;
+struct solib_ops;
+extern const solib_ops solib_aix_so_ops;
extern CORE_ADDR solib_aix_get_toc_value (CORE_ADDR pc);
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 27d4546e5774..5ef0646d5385 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -655,7 +655,7 @@ darwin_bfd_open (const char *pathname)
return res;
}
-const struct target_so_ops darwin_so_ops =
+const solib_ops darwin_so_ops =
{
darwin_relocate_section_addresses,
nullptr,
diff --git a/gdb/solib-darwin.h b/gdb/solib-darwin.h
index ceabb95a0bd3..d6be9eb5b426 100644
--- a/gdb/solib-darwin.h
+++ b/gdb/solib-darwin.h
@@ -20,8 +20,8 @@
#ifndef SOLIB_DARWIN_H
#define SOLIB_DARWIN_H
-struct target_so_ops;
+struct solib_ops;
-extern const struct target_so_ops darwin_so_ops;
+extern const solib_ops darwin_so_ops;
#endif /* solib-darwin.h */
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index d90bb7510a30..1dc85450e5f4 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -902,7 +902,7 @@ show_dsbt_debug (struct ui_file *file, int from_tty,
gdb_printf (file, _("solib-dsbt debugging is %s.\n"), value);
}
-const struct target_so_ops dsbt_so_ops =
+const solib_ops dsbt_so_ops =
{
dsbt_relocate_section_addresses,
nullptr,
diff --git a/gdb/solib-dsbt.h b/gdb/solib-dsbt.h
index ccfee0841da5..e1f7d1438482 100644
--- a/gdb/solib-dsbt.h
+++ b/gdb/solib-dsbt.h
@@ -20,8 +20,8 @@
#ifndef SOLIB_DSBT_H
#define SOLIB_DSBT_H
-struct target_so_ops;
+struct solib_ops;
-extern const struct target_so_ops dsbt_so_ops;
+extern const solib_ops dsbt_so_ops;
#endif /* solib-dsbt.h */
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 9a098f7943f2..c425b3376de0 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -237,7 +237,7 @@ static void frv_relocate_main_executable (void);
static CORE_ADDR main_got (void);
static int enable_break2 (void);
-/* Implement the "open_symbol_file_object" target_so_ops method. */
+/* Implement the "open_symbol_file_object" solib_ops method. */
static int
open_symbol_file_object (int from_tty)
@@ -304,7 +304,7 @@ lm_base (void)
}
-/* Implement the "current_sos" target_so_ops method. */
+/* Implement the "current_sos" solib_ops method. */
static intrusive_list<solib>
frv_current_sos ()
@@ -1073,7 +1073,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile)
return 0;
}
-const struct target_so_ops frv_so_ops =
+const solib_ops frv_so_ops =
{
frv_relocate_section_addresses,
nullptr,
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index f4538c1540bb..02ab36bb95e6 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -154,7 +154,7 @@ struct solib_info
/* Per-inferior data key. */
static const registry<inferior>::key<solib_info> rocm_solib_data;
-static target_so_ops rocm_solib_ops;
+static solib_ops rocm_solib_ops;
/* Fetch the solib_info data for INF. */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index eb726a203af6..2377ed3341dc 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -977,7 +977,7 @@ svr4_free_objfile_observer (struct objfile *objfile)
probes_table_remove_objfile_probes (objfile);
}
-/* Implement target_so_ops.clear_so. */
+/* Implement solib_ops.clear_so. */
static void
svr4_clear_so (const solib &so)
@@ -1386,7 +1386,7 @@ svr4_collect_probes_sos (svr4_info *info)
return res;
}
-/* Implement the main part of the "current_sos" target_so_ops
+/* Implement the main part of the "current_sos" solib_ops
method. */
static intrusive_list<solib>
@@ -1414,7 +1414,7 @@ svr4_current_sos_1 (svr4_info *info)
return sos;
}
-/* Implement the "current_sos" target_so_ops method. */
+/* Implement the "current_sos" solib_ops method. */
static intrusive_list<solib>
svr4_current_sos ()
@@ -3353,7 +3353,7 @@ svr4_iterate_over_objfiles_in_search_order
}
}
-const struct target_so_ops svr4_so_ops =
+const struct solib_ops svr4_so_ops =
{
svr4_relocate_section_addresses,
svr4_clear_so,
diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h
index fe09c294c769..579fe6d98439 100644
--- a/gdb/solib-svr4.h
+++ b/gdb/solib-svr4.h
@@ -23,9 +23,9 @@
#include "solist.h"
struct objfile;
-struct target_so_ops;
+struct solib_ops;
-extern const struct target_so_ops svr4_so_ops;
+extern const solib_ops svr4_so_ops;
/* Link map info to include in an allocated so_list entry. */
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 5e46adcf224a..bb4c6a6c174f 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -403,7 +403,7 @@ solib_target_in_dynsym_resolve_code (CORE_ADDR pc)
return in_plt_section (pc);
}
-const struct target_so_ops solib_target_so_ops =
+const solib_ops solib_target_so_ops =
{
solib_target_relocate_section_addresses,
nullptr,
diff --git a/gdb/solib-target.h b/gdb/solib-target.h
index 177a15edb2ac..70f53c545532 100644
--- a/gdb/solib-target.h
+++ b/gdb/solib-target.h
@@ -20,7 +20,7 @@
#ifndef SOLIB_TARGET_H
#define SOLIB_TARGET_H
-struct target_so_ops;
-extern const struct target_so_ops solib_target_so_ops;
+struct solib_ops;
+extern const solib_ops solib_target_so_ops;
#endif /* solib-target.h */
diff --git a/gdb/solib.c b/gdb/solib.c
index be9ec3dde37f..0a888430cf9b 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -57,20 +57,22 @@ bool debug_solib;
symbol files. This takes precedence over the environment variables PATH
and LD_LIBRARY_PATH. */
static std::string solib_search_path;
+
static void
show_solib_search_path (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The search path for loading non-absolute "
- "shared library symbol files is %s.\n"),
+ gdb_printf (file,
+ _ ("The search path for loading non-absolute "
+ "shared library symbol files is %s.\n"),
value);
}
/* Same as HAVE_DOS_BASED_FILE_SYSTEM, but useable as an rvalue. */
#if (HAVE_DOS_BASED_FILE_SYSTEM)
-# define DOS_BASED_FILE_SYSTEM 1
+#define DOS_BASED_FILE_SYSTEM 1
#else
-# define DOS_BASED_FILE_SYSTEM 0
+#define DOS_BASED_FILE_SYSTEM 0
#endif
/* Return the full pathname of a binary file (the main executable or a
@@ -111,7 +113,7 @@ show_solib_search_path (struct ui_file *file, int from_tty,
static gdb::unique_xmalloc_ptr<char>
solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
int found_file = -1;
gdb::unique_xmalloc_ptr<char> temp_pathname;
const char *fskind = effective_target_file_system_kind ();
@@ -215,29 +217,27 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
}
/* Now see if we can open it. */
- found_file = gdb_open_cloexec (temp_pathname.get (),
- O_RDONLY | O_BINARY, 0).release ();
+ found_file = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0)
+ .release ();
/* If the search in gdb_sysroot failed, and the path name has a
drive spec (e.g, c:/foo), try stripping ':' from the drive spec,
and retrying in the sysroot:
c:/foo/bar.dll ==> /sysroot/c/foo/bar.dll. */
- if (found_file < 0
- && sysroot != NULL
+ if (found_file < 0 && sysroot != NULL
&& HAS_TARGET_DRIVE_SPEC (fskind, in_pathname))
{
bool need_dir_separator = !IS_DIR_SEPARATOR (in_pathname[2]);
char drive[2] = { in_pathname[0], '\0' };
- temp_pathname.reset (concat (sysroot,
- SLASH_STRING,
- drive,
+ temp_pathname.reset (concat (sysroot, SLASH_STRING, drive,
need_dir_separator ? SLASH_STRING : "",
in_pathname + 2, (char *) NULL));
- found_file = gdb_open_cloexec (temp_pathname.get (),
- O_RDONLY | O_BINARY, 0).release ();
+ found_file
+ = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0)
+ .release ();
if (found_file < 0)
{
/* If the search in gdb_sysroot still failed, try fully
@@ -250,8 +250,9 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
need_dir_separator ? SLASH_STRING : "",
in_pathname + 2, (char *) NULL));
- found_file = gdb_open_cloexec (temp_pathname.get (),
- O_RDONLY | O_BINARY, 0).release ();
+ found_file
+ = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0)
+ .release ();
}
}
@@ -282,8 +283,8 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
solib_search_path (if any). */
if (is_solib && found_file < 0 && !solib_search_path.empty ())
found_file = openp (solib_search_path.c_str (),
- OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
- in_pathname, O_RDONLY | O_BINARY, &temp_pathname);
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
+ O_RDONLY | O_BINARY, &temp_pathname);
/* If not found, and we're looking for a solib, next search the
solib_search_path (if any) for the basename only (ignoring the
@@ -310,10 +311,10 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
/* If not found, and we're looking for a solib, next search the
inferior's $LD_LIBRARY_PATH environment variable. */
if (is_solib && found_file < 0 && sysroot == NULL)
- found_file = openp (current_inferior ()->environment.get
- ("LD_LIBRARY_PATH"),
- OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
- O_RDONLY | O_BINARY, &temp_pathname);
+ found_file
+ = openp (current_inferior ()->environment.get ("LD_LIBRARY_PATH"),
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
+ O_RDONLY | O_BINARY, &temp_pathname);
if (fd == NULL)
{
@@ -427,8 +428,8 @@ solib_bfd_fopen (const char *pathname, int fd)
if (abfd == NULL)
{
/* Arrange to free PATHNAME when the error is thrown. */
- error (_("Could not open `%s' as an executable file: %s"),
- pathname, bfd_errmsg (bfd_get_error ()));
+ error (_ ("Could not open `%s' as an executable file: %s"), pathname,
+ bfd_errmsg (bfd_get_error ()));
}
return abfd;
@@ -460,16 +461,16 @@ solib_bfd_open (const char *pathname)
/* Check bfd format. */
if (!bfd_check_format (abfd.get (), bfd_object))
- error (_("`%s': not in executable format: %s"),
+ error (_ ("`%s': not in executable format: %s"),
bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (current_inferior ()->arch ());
if (!b->compatible (b, bfd_get_arch_info (abfd.get ())))
- error (_("`%s': Shared library architecture %s is not compatible "
- "with target architecture %s."), bfd_get_filename (abfd.get ()),
- bfd_get_arch_info (abfd.get ())->printable_name,
- b->printable_name);
+ error (_ ("`%s': Shared library architecture %s is not compatible "
+ "with target architecture %s."),
+ bfd_get_filename (abfd.get ()),
+ bfd_get_arch_info (abfd.get ())->printable_name, b->printable_name);
return abfd;
}
@@ -482,20 +483,20 @@ typedef std::unordered_map<std::string, std::string> soname_build_id_map;
/* Key used to associate a soname_build_id_map to a core file bfd. */
static const struct registry<bfd>::key<soname_build_id_map>
- cbfd_soname_build_id_data_key;
+ cbfd_soname_build_id_data_key;
/* See solib.h. */
void
-set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd,
- const char *soname,
+set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname,
const bfd_build_id *build_id)
{
gdb_assert (abfd.get () != nullptr);
gdb_assert (soname != nullptr);
gdb_assert (build_id != nullptr);
- soname_build_id_map *mapptr = cbfd_soname_build_id_data_key.get (abfd.get ());
+ soname_build_id_map *mapptr
+ = cbfd_soname_build_id_data_key.get (abfd.get ());
if (mapptr == nullptr)
mapptr = cbfd_soname_build_id_data_key.emplace (abfd.get ());
@@ -541,7 +542,7 @@ get_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname)
static int
solib_map_sections (solib &so)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (so.so_name.c_str ()));
gdb_bfd_ref_ptr abfd (ops->bfd_open (filename.get ()));
@@ -565,16 +566,16 @@ solib_map_sections (solib &so)
}
if (abfd == nullptr || mismatch)
{
- scoped_fd fd = debuginfod_exec_query ((const unsigned char*)
- build_id_hexstr.get (),
- 0, so.so_name.c_str (),
- &filename);
+ scoped_fd fd = debuginfod_exec_query (
+ (const unsigned char *) build_id_hexstr.get (), 0,
+ so.so_name.c_str (), &filename);
if (fd.get () >= 0)
abfd = ops->bfd_open (filename.get ());
else if (mismatch)
- warning (_("Build-id of %ps does not match core file."),
- styled_string (file_name_style.style (), filename.get ()));
+ warning (_ ("Build-id of %ps does not match core file."),
+ styled_string (file_name_style.style (),
+ filename.get ()));
}
}
@@ -591,7 +592,7 @@ solib_map_sections (solib &so)
that objfile's path, and the target is different from the host,
GDB/MI will not provide the correct host-side path. */
if (strlen (bfd_get_filename (so.abfd.get ())) >= SO_NAME_MAX_PATH_SIZE)
- error (_("Shared library file name is too long."));
+ error (_ ("Shared library file name is too long."));
so.so_name = bfd_get_filename (so.abfd.get ());
so.sections = build_section_table (so.abfd.get ());
@@ -628,7 +629,7 @@ solib_map_sections (solib &so)
void
solib::clear ()
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
this->sections.clear ();
this->abfd = nullptr;
@@ -667,7 +668,6 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
}
else
{
-
flags |= current_inferior ()->symfile_flags;
try
@@ -676,8 +676,8 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
so.objfile = nullptr;
for (objfile *objfile : current_program_space->objfiles ())
{
- if (filename_cmp (objfile_name (objfile),
- so.so_name.c_str ()) == 0
+ if (filename_cmp (objfile_name (objfile), so.so_name.c_str ())
+ == 0
&& objfile->addr_low == so.addr_low)
{
so.objfile = objfile;
@@ -689,10 +689,9 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
section_addr_info sap
= build_section_addr_info_from_section_table (so.sections);
gdb_bfd_ref_ptr tmp_bfd = so.abfd;
- so.objfile = symbol_file_add_from_bfd (tmp_bfd,
- so.so_name.c_str (),
- flags, &sap,
- OBJF_SHARED, nullptr);
+ so.objfile
+ = symbol_file_add_from_bfd (tmp_bfd, so.so_name.c_str (),
+ flags, &sap, OBJF_SHARED, nullptr);
so.objfile->addr_low = so.addr_low;
}
@@ -700,8 +699,9 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
}
catch (const gdb_exception_error &e)
{
- exception_fprintf (gdb_stderr, e, _("Error while reading shared"
- " library symbols for %s:\n"),
+ exception_fprintf (gdb_stderr, e,
+ _ ("Error while reading shared"
+ " library symbols for %s:\n"),
so.so_name.c_str ());
}
@@ -746,7 +746,7 @@ notify_solib_unloaded (program_space *pspace, const solib &so)
void
update_solib_list (int from_tty)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
@@ -885,8 +885,8 @@ update_solib_list (int from_tty)
catch (const gdb_exception_error &e)
{
exception_fprintf (gdb_stderr, e,
- _("Error while mapping shared "
- "library sections:\n"));
+ _ ("Error while mapping shared "
+ "library sections:\n"));
}
/* Notify any observer that the shared object has been
@@ -905,12 +905,12 @@ update_solib_list (int from_tty)
stand out well. */
if (not_found == 1)
- warning (_("Could not load shared library symbols for %s.\n"
- "Do you need \"set solib-search-path\" "
- "or \"set sysroot\"?"),
+ warning (_ ("Could not load shared library symbols for %s.\n"
+ "Do you need \"set solib-search-path\" "
+ "or \"set sysroot\"?"),
not_found_filename);
else if (not_found > 1)
- warning (_("\
+ warning (_ ("\
Could not load shared library symbols for %d libraries, e.g. %s.\n\
Use the \"info sharedlibrary\" command to see the complete listing.\n\
Do you need \"set solib-search-path\" or \"set sysroot\"?"),
@@ -918,7 +918,6 @@ Do you need \"set solib-search-path\" or \"set sysroot\"?"),
}
}
-
/* Return non-zero if NAME is the libpthread shared library.
Uses a fairly simplistic heuristic approach where we check
@@ -933,7 +932,7 @@ bool
libpthread_name_p (const char *name)
{
return (strstr (name, "/libpthread") != NULL
- || strstr (name, "/libc.") != NULL );
+ || strstr (name, "/libc.") != NULL);
}
/* Return non-zero if SO is the libpthread shared library. */
@@ -960,11 +959,11 @@ solib_add (const char *pattern, int from_tty, int readsyms)
{
if (pattern != NULL)
{
- gdb_printf (_("Loading symbols for shared libraries: %s\n"),
+ gdb_printf (_ ("Loading symbols for shared libraries: %s\n"),
pattern);
}
else
- gdb_printf (_("Loading symbols for shared libraries.\n"));
+ gdb_printf (_ ("Loading symbols for shared libraries.\n"));
}
current_program_space->solib_add_generation++;
@@ -974,7 +973,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
char *re_err = re_comp (pattern);
if (re_err)
- error (_("Invalid regexp: %s"), re_err);
+ error (_ ("Invalid regexp: %s"), re_err);
}
update_solib_list (from_tty);
@@ -988,18 +987,17 @@ solib_add (const char *pattern, int from_tty, int readsyms)
symfile_add_flags add_flags = SYMFILE_DEFER_BP_RESET;
if (from_tty)
- add_flags |= SYMFILE_VERBOSE;
+ add_flags |= SYMFILE_VERBOSE;
for (solib &gdb : current_program_space->solibs ())
- if (! pattern || re_exec (gdb.so_name.c_str ()))
+ if (!pattern || re_exec (gdb.so_name.c_str ()))
{
/* Normally, we would read the symbols from that library
only if READSYMS is set. However, we're making a small
exception for the pthread library, because we sometimes
need the library symbols to be loaded in order to provide
thread support (x86-linux for instance). */
- const int add_this_solib =
- (readsyms || libpthread_solib_p (gdb));
+ const int add_this_solib = (readsyms || libpthread_solib_p (gdb));
any_matches = true;
if (add_this_solib)
@@ -1009,7 +1007,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
/* If no pattern was given, be quiet for shared
libraries we have already loaded. */
if (pattern && (from_tty || info_verbose))
- gdb_printf (_("Symbols already loaded for %s\n"),
+ gdb_printf (_ ("Symbols already loaded for %s\n"),
gdb.so_name.c_str ());
}
else if (solib_read_symbols (gdb, add_flags))
@@ -1020,9 +1018,9 @@ solib_add (const char *pattern, int from_tty, int readsyms)
if (loaded_any_symbols)
breakpoint_re_set ();
- if (from_tty && pattern && ! any_matches)
- gdb_printf
- ("No loaded shared libraries match the pattern `%s'.\n", pattern);
+ if (from_tty && pattern && !any_matches)
+ gdb_printf ("No loaded shared libraries match the pattern `%s'.\n",
+ pattern);
if (loaded_any_symbols)
{
@@ -1052,7 +1050,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
char *re_err = re_comp (pattern);
if (re_err)
- error (_("Invalid regexp: %s"), re_err);
+ error (_ ("Invalid regexp: %s"), re_err);
}
/* "0x", a little whitespace, and two hex digits per byte of pointers. */
@@ -1068,7 +1066,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
{
if (!so.so_name.empty ())
{
- if (pattern && ! re_exec (so.so_name.c_str ()))
+ if (pattern && !re_exec (so.so_name.c_str ()))
continue;
++nr_libs;
}
@@ -1090,7 +1088,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
if (so.so_name.empty ())
continue;
- if (pattern && ! re_exec (so.so_name.c_str ()))
+ if (pattern && !re_exec (so.so_name.c_str ()))
continue;
ui_out_emit_tuple tuple_emitter (uiout, "lib");
@@ -1106,9 +1104,8 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
uiout->field_skip ("to");
}
- if (! top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
- && so.symbols_loaded
- && !objfile_has_symbols (so.objfile))
+ if (!top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
+ && so.symbols_loaded && !objfile_has_symbols (so.objfile))
{
so_missing_debug_info = true;
uiout->field_string ("syms-read", "Yes (*)");
@@ -1125,15 +1122,15 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
if (nr_libs == 0)
{
if (pattern)
- uiout->message (_("No shared libraries matched.\n"));
+ uiout->message (_ ("No shared libraries matched.\n"));
else
- uiout->message (_("No shared libraries loaded at this time.\n"));
+ uiout->message (_ ("No shared libraries loaded at this time.\n"));
}
else
{
if (so_missing_debug_info)
- uiout->message (_("(*): Shared library is missing "
- "debugging information.\n"));
+ uiout->message (_ ("(*): Shared library is missing "
+ "debugging information.\n"));
}
}
@@ -1175,7 +1172,7 @@ solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
bool
solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
if (ops->keep_data_in_core)
return ops->keep_data_in_core (vaddr, size) != 0;
@@ -1188,17 +1185,15 @@ solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
void
clear_solib (void)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
disable_breakpoints_in_shlibs ();
- current_program_space->so_list.clear_and_dispose ([] (solib *so)
- {
- notify_solib_unloaded (current_program_space, *so);
- current_program_space->remove_target_sections (so);
- delete so;
- });
-
+ current_program_space->so_list.clear_and_dispose ([] (solib *so) {
+ notify_solib_unloaded (current_program_space, *so);
+ current_program_space->remove_target_sections (so);
+ delete so;
+ });
if (ops->clear_solib != nullptr)
ops->clear_solib (current_program_space);
@@ -1212,7 +1207,7 @@ clear_solib (void)
void
solib_create_inferior_hook (int from_tty)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
ops->solib_create_inferior_hook (from_tty);
}
@@ -1222,7 +1217,7 @@ solib_create_inferior_hook (int from_tty)
bool
in_solib_dynsym_resolve_code (CORE_ADDR pc)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
return ops->in_dynsym_resolve_code (pc) != 0;
}
@@ -1258,7 +1253,7 @@ no_shared_libraries (const char *ignored, int from_tty)
void
update_solib_breakpoints (void)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
if (ops->update_breakpoints != NULL)
ops->update_breakpoints ();
@@ -1269,7 +1264,7 @@ update_solib_breakpoints (void)
void
handle_solib_event (void)
{
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
if (ops->handle_event != NULL)
ops->handle_event ();
@@ -1291,7 +1286,7 @@ static void
reload_shared_libraries_1 (int from_tty)
{
if (print_symbol_loading_p (from_tty, 0, 0))
- gdb_printf (_("Loading symbols for shared libraries.\n"));
+ gdb_printf (_ ("Loading symbols for shared libraries.\n"));
for (solib &so : current_program_space->solibs ())
{
@@ -1302,8 +1297,8 @@ reload_shared_libraries_1 (int from_tty)
if (from_tty)
add_flags |= SYMFILE_VERBOSE;
- gdb::unique_xmalloc_ptr<char> filename
- (tilde_expand (so.so_original_name.c_str ()));
+ gdb::unique_xmalloc_ptr<char> filename (
+ tilde_expand (so.so_original_name.c_str ()));
gdb_bfd_ref_ptr abfd (solib_bfd_open (filename.get ()));
if (abfd != NULL)
found_pathname = bfd_get_filename (abfd.get ());
@@ -1314,7 +1309,7 @@ reload_shared_libraries_1 (int from_tty)
|| (found_pathname != NULL
&& filename_cmp (found_pathname, so.so_name.c_str ()) != 0))
{
- if (so.objfile && ! (so.objfile->flags & OBJF_USERLOADED)
+ if (so.objfile && !(so.objfile->flags & OBJF_USERLOADED)
&& !solib_used (so))
so.objfile->unlink ();
current_program_space->remove_target_sections (&so);
@@ -1337,14 +1332,14 @@ reload_shared_libraries_1 (int from_tty)
catch (const gdb_exception_error &e)
{
exception_fprintf (gdb_stderr, e,
- _("Error while mapping "
- "shared library sections:\n"));
+ _ ("Error while mapping "
+ "shared library sections:\n"));
got_error = true;
}
- if (!got_error
- && (auto_solib_add || was_loaded || libpthread_solib_p (so)))
- solib_read_symbols (so, add_flags);
+ if (!got_error
+ && (auto_solib_add || was_loaded || libpthread_solib_p (so)))
+ solib_read_symbols (so, add_flags);
}
}
}
@@ -1355,7 +1350,7 @@ reload_shared_libraries (const char *ignored, int from_tty,
{
reload_shared_libraries_1 (from_tty);
- const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
/* Creating inferior hooks here has two purposes. First, if we reload
shared libraries then the address of solib breakpoint we've computed
@@ -1419,9 +1414,9 @@ gdb_sysroot_changed (const char *ignored, int from_tty,
if (!warning_issued)
{
- warning (_("\"%s\" is deprecated, use \"%s\" instead."),
- old_prefix, new_prefix);
- warning (_("sysroot set to \"%s\"."), gdb_sysroot.c_str ());
+ warning (_ ("\"%s\" is deprecated, use \"%s\" instead."), old_prefix,
+ new_prefix);
+ warning (_ ("sysroot set to \"%s\"."), gdb_sysroot.c_str ());
warning_issued = true;
}
@@ -1434,19 +1429,18 @@ static void
show_auto_solib_add (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Autoloading of shared library symbols is %s.\n"),
+ gdb_printf (file, _ ("Autoloading of shared library symbols is %s.\n"),
value);
}
-
/* Lookup the value for a specific symbol from dynamic symbol table. Look
up symbol from ABFD. MATCH_SYM is a callback function to determine
whether to pick up a symbol. DATA is the input of this callback
function. Return 0 if symbol is not found. */
CORE_ADDR
-gdb_bfd_lookup_symbol_from_symtab
- (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
+gdb_bfd_lookup_symbol_from_symtab (
+ bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
{
long storage_needed = bfd_get_symtab_upper_bound (abfd);
CORE_ADDR symaddr = 0;
@@ -1457,12 +1451,12 @@ gdb_bfd_lookup_symbol_from_symtab
gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
asymbol **symbol_table = storage.data ();
- unsigned int number_of_symbols =
- bfd_canonicalize_symtab (abfd, symbol_table);
+ unsigned int number_of_symbols
+ = bfd_canonicalize_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
{
- asymbol *sym = *symbol_table++;
+ asymbol *sym = *symbol_table++;
if (match_sym (sym))
{
@@ -1478,7 +1472,9 @@ gdb_bfd_lookup_symbol_from_symtab
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& gdbarch_elf_make_msymbol_special_p (gdbarch))
{
- struct minimal_symbol msym {};
+ struct minimal_symbol msym
+ {
+ };
msym.set_value_address (symaddr);
gdbarch_elf_make_msymbol_special (gdbarch, sym, &msym);
@@ -1526,8 +1522,8 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
return 0;
bool found = false;
- for (const target_section &target_section
- : current_program_space->target_sections ())
+ for (const target_section &target_section :
+ current_program_space->target_sections ())
if (sect == target_section.the_bfd_section)
{
dyn_addr = target_section.addr;
@@ -1556,46 +1552,44 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
/* Iterate over BUF and scan for DYNTAG. If found, set PTR and return. */
step = (arch_size == 32) ? sizeof (Elf32_External_Dyn)
: sizeof (Elf64_External_Dyn);
- for (bufend = buf + sect_size;
- buf < bufend;
- buf += step)
- {
- if (arch_size == 32)
- {
- x_dynp_32 = (Elf32_External_Dyn *) buf;
- current_dyntag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_tag);
- dyn_ptr = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_un.d_ptr);
- }
- else
- {
- x_dynp_64 = (Elf64_External_Dyn *) buf;
- current_dyntag = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_tag);
- dyn_ptr = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_un.d_ptr);
- }
- if (current_dyntag == DT_NULL)
- return 0;
- if (current_dyntag == desired_dyntag)
- {
- /* If requested, try to read the runtime value of this .dynamic
+ for (bufend = buf + sect_size; buf < bufend; buf += step)
+ {
+ if (arch_size == 32)
+ {
+ x_dynp_32 = (Elf32_External_Dyn *) buf;
+ current_dyntag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_tag);
+ dyn_ptr = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_un.d_ptr);
+ }
+ else
+ {
+ x_dynp_64 = (Elf64_External_Dyn *) buf;
+ current_dyntag = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_tag);
+ dyn_ptr = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_un.d_ptr);
+ }
+ if (current_dyntag == DT_NULL)
+ return 0;
+ if (current_dyntag == desired_dyntag)
+ {
+ /* If requested, try to read the runtime value of this .dynamic
entry. */
- if (ptr)
- {
- struct type *ptr_type;
- gdb_byte ptr_buf[8];
- CORE_ADDR ptr_addr_1;
-
- ptr_type
- = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
- ptr_addr_1 = dyn_addr + (buf - bufstart) + arch_size / 8;
- if (target_read_memory (ptr_addr_1, ptr_buf, arch_size / 8) == 0)
- dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
- *ptr = dyn_ptr;
- if (ptr_addr)
- *ptr_addr = dyn_addr + (buf - bufstart);
- }
- return 1;
- }
- }
+ if (ptr)
+ {
+ struct type *ptr_type;
+ gdb_byte ptr_buf[8];
+ CORE_ADDR ptr_addr_1;
+
+ ptr_type = builtin_type (current_inferior ()->arch ())
+ ->builtin_data_ptr;
+ ptr_addr_1 = dyn_addr + (buf - bufstart) + arch_size / 8;
+ if (target_read_memory (ptr_addr_1, ptr_buf, arch_size / 8) == 0)
+ dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
+ *ptr = dyn_ptr;
+ if (ptr_addr)
+ *ptr_addr = dyn_addr + (buf - bufstart);
+ }
+ return 1;
+ }
+ }
return 0;
}
@@ -1619,7 +1613,8 @@ gdb_bfd_read_elf_soname (const char *filename)
if (!gdb_bfd_scan_elf_dyntag (DT_SONAME, abfd.get (), &idx, nullptr))
return {};
- struct bfd_section *dynstr = bfd_get_section_by_name (abfd.get (), ".dynstr");
+ struct bfd_section *dynstr
+ = bfd_get_section_by_name (abfd.get (), ".dynstr");
int sect_size = bfd_section_size (dynstr);
if (dynstr == nullptr || sect_size <= idx)
return {};
@@ -1643,8 +1638,8 @@ gdb_bfd_read_elf_soname (const char *filename)
if symbol is not found. */
static CORE_ADDR
-bfd_lookup_symbol_from_dyn_symtab
- (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
+bfd_lookup_symbol_from_dyn_symtab (
+ bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
{
long storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
CORE_ADDR symaddr = 0;
@@ -1654,8 +1649,8 @@ bfd_lookup_symbol_from_dyn_symtab
unsigned int i;
gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
asymbol **symbol_table = storage.data ();
- unsigned int number_of_symbols =
- bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
+ unsigned int number_of_symbols
+ = bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
{
@@ -1679,8 +1674,8 @@ bfd_lookup_symbol_from_dyn_symtab
found. */
CORE_ADDR
-gdb_bfd_lookup_symbol
- (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
+gdb_bfd_lookup_symbol (bfd *abfd,
+ gdb::function_view<bool (const asymbol *)> match_sym)
{
CORE_ADDR symaddr = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym);
@@ -1709,50 +1704,52 @@ remove_user_added_objfile (struct objfile *objfile)
}
void _initialize_solib ();
+
void
_initialize_solib ()
{
- gdb::observers::free_objfile.attach (remove_user_added_objfile,
- "solib");
- gdb::observers::inferior_execd.attach ([] (inferior *exec_inf,
- inferior *follow_inf)
- {
- solib_create_inferior_hook (0);
- }, "solib");
-
- add_com ("sharedlibrary", class_files, sharedlibrary_command,
- _("Load shared object library symbols for files matching REGEXP."));
+ gdb::observers::free_objfile.attach (remove_user_added_objfile, "solib");
+ gdb::observers::inferior_execd.attach (
+ [] (inferior *exec_inf, inferior *follow_inf) {
+ solib_create_inferior_hook (0);
+ },
+ "solib");
+
+ add_com (
+ "sharedlibrary", class_files, sharedlibrary_command,
+ _ ("Load shared object library symbols for files matching REGEXP."));
cmd_list_element *info_sharedlibrary_cmd
= add_info ("sharedlibrary", info_sharedlibrary_command,
- _("Status of loaded shared object libraries."));
+ _ ("Status of loaded shared object libraries."));
add_info_alias ("dll", info_sharedlibrary_cmd, 1);
add_com ("nosharedlibrary", class_files, no_shared_libraries,
- _("Unload all shared object library symbols."));
-
- add_setshow_boolean_cmd ("auto-solib-add", class_support,
- &auto_solib_add, _("\
-Set autoloading of shared library symbols."), _("\
-Show autoloading of shared library symbols."), _("\
+ _ ("Unload all shared object library symbols."));
+
+ add_setshow_boolean_cmd ("auto-solib-add", class_support, &auto_solib_add,
+ _ ("\
+Set autoloading of shared library symbols."),
+ _ ("\
+Show autoloading of shared library symbols."),
+ _ ("\
If \"on\", symbols from all shared object libraries will be loaded\n\
automatically when the inferior begins execution, when the dynamic linker\n\
informs gdb that a new library has been loaded, or when attaching to the\n\
inferior. Otherwise, symbols must be loaded manually, using \
`sharedlibrary'."),
- NULL,
- show_auto_solib_add,
- &setlist, &showlist);
+ NULL, show_auto_solib_add, &setlist, &showlist);
set_show_commands sysroot_cmds
= add_setshow_optional_filename_cmd ("sysroot", class_support,
- &gdb_sysroot, _("\
-Set an alternate system root."), _("\
-Show the current system root."), _("\
+ &gdb_sysroot, _ ("\
+Set an alternate system root."),
+ _ ("\
+Show the current system root."),
+ _ ("\
The system root is used to load absolute shared library symbol files.\n\
For other (relative) files, you can add directories using\n\
`set solib-search-path'."),
- gdb_sysroot_changed,
- NULL,
- &setlist, &showlist);
+ gdb_sysroot_changed, NULL, &setlist,
+ &showlist);
add_alias_cmd ("solib-absolute-prefix", sysroot_cmds.set, class_support, 0,
&setlist);
@@ -1760,22 +1757,22 @@ For other (relative) files, you can add directories using\n\
&showlist);
add_setshow_optional_filename_cmd ("solib-search-path", class_support,
- &solib_search_path, _("\
+ &solib_search_path, _ ("\
Set the search path for loading non-absolute shared library symbol files."),
- _("\
+ _ ("\
Show the search path for loading non-absolute shared library symbol files."),
- _("\
+ _ ("\
This takes precedence over the environment variables \
PATH and LD_LIBRARY_PATH."),
reload_shared_libraries,
- show_solib_search_path,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("solib", class_maintenance,
- &debug_solib, _("\
-Set solib debugging."), _("\
-Show solib debugging."), _("\
+ show_solib_search_path, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("solib", class_maintenance, &debug_solib, _ ("\
+Set solib debugging."),
+ _ ("\
+Show solib debugging."),
+ _ ("\
When true, solib-related debugging output is enabled."),
- nullptr, nullptr,
- &setdebuglist, &showdebuglist);
+ nullptr, nullptr, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/solib.h b/gdb/solib.h
index d267e3fefa47..69183278318b 100644
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -23,7 +23,7 @@
/* Forward decl's for prototypes */
struct solib;
struct target_ops;
-struct target_so_ops;
+struct solib_ops;
struct program_space;
#include "gdb_bfd.h"
diff --git a/gdb/solist.h b/gdb/solist.h
index b485d3748800..f0d22080de17 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -93,7 +93,7 @@ struct solib : intrusive_list_node<solib>
CORE_ADDR addr_low = 0, addr_high = 0;
};
-struct target_so_ops
+struct solib_ops
{
/* Adjust the section binding addresses by the base address at
which the object was actually mapped. */
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index f30c449e8bef..2750e663b7f1 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -862,7 +862,7 @@ windows_get_siginfo_type (struct gdbarch *gdbarch)
return siginfo_type;
}
-/* Implement the "solib_create_inferior_hook" target_so_ops method. */
+/* Implement the "solib_create_inferior_hook" solib_ops method. */
static void
windows_solib_create_inferior_hook (int from_tty)
@@ -910,7 +910,7 @@ windows_solib_create_inferior_hook (int from_tty)
}
}
-static struct target_so_ops windows_so_ops;
+static solib_ops windows_so_ops;
/* Common parts for gdbarch initialization for the Windows and Cygwin OS
ABIs. */
--
2.43.0
More information about the Gdb-patches
mailing list