Automatic date update in version.in
[binutils-gdb.git] / gdb / solib.h
blobf9b4d3566d7171b475553afd6f345fd2c8097b78
1 /* Shared library declarations for GDB, the GNU Debugger.
3 Copyright (C) 1992-2022 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef SOLIB_H
21 #define SOLIB_H
23 /* Forward decl's for prototypes */
24 struct so_list;
25 struct target_ops;
26 struct target_so_ops;
27 struct program_space;
29 #include "gdb_bfd.h"
30 #include "symfile-add-flags.h"
32 /* Called when we free all symtabs, to free the shared library information
33 as well. */
35 extern void clear_solib (void);
37 /* Called to add symbols from a shared library to gdb's symbol table. */
39 extern void solib_add (const char *, int, int);
40 extern bool solib_read_symbols (struct so_list *, symfile_add_flags);
42 /* Function to be called when the inferior starts up, to discover the
43 names of shared libraries that are dynamically linked, the base
44 addresses to which they are linked, and sufficient information to
45 read in their symbols at a later time. */
47 extern void solib_create_inferior_hook (int from_tty);
49 /* If ADDR lies in a shared library, return its name. */
51 extern char *solib_name_from_address (struct program_space *, CORE_ADDR);
53 /* Return true if ADDR lies within SOLIB. */
55 extern bool solib_contains_address_p (const struct so_list *, CORE_ADDR);
57 /* Return whether the data starting at VADDR, size SIZE, must be kept
58 in a core file for shared libraries loaded before "gcore" is used
59 to be handled correctly when the core file is loaded. This only
60 applies when the section would otherwise not be kept in the core
61 file (in particular, for readonly sections). */
63 extern bool solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size);
65 /* Return true if PC lies in the dynamic symbol resolution code of the
66 run time loader. */
68 extern bool in_solib_dynsym_resolve_code (CORE_ADDR);
70 /* Discard symbols that were auto-loaded from shared libraries. */
72 extern void no_shared_libraries (const char *ignored, int from_tty);
74 /* Set the solib operations for GDBARCH to NEW_OPS. */
76 extern void set_solib_ops (struct gdbarch *gdbarch,
77 const struct target_so_ops *new_ops);
79 /* Synchronize GDB's shared object list with inferior's.
81 Extract the list of currently loaded shared objects from the
82 inferior, and compare it with the list of shared objects in the
83 current program space's list of shared libraries. Edit
84 so_list_head to bring it in sync with the inferior's new list.
86 If we notice that the inferior has unloaded some shared objects,
87 free any symbolic info GDB had read about those shared objects.
89 Don't load symbolic info for any new shared objects; just add them
90 to the list, and leave their symbols_loaded flag clear.
92 If FROM_TTY is non-null, feel free to print messages about what
93 we're doing. */
95 extern void update_solib_list (int from_tty);
97 /* Return true if NAME is the libpthread shared library. */
99 extern bool libpthread_name_p (const char *name);
101 /* Look up symbol from both symbol table and dynamic string table. */
103 extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
104 int (*match_sym) (const asymbol *,
105 const void *),
106 const void *data);
108 /* Look up symbol from symbol table. */
110 extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
111 int (*match_sym)
112 (const asymbol *,
113 const void *),
114 const void *data);
116 /* Scan for DESIRED_DYNTAG in .dynamic section of ABFD. If DESIRED_DYNTAG is
117 found, 1 is returned and the corresponding PTR and PTR_ADDR are set. */
119 extern int gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd,
120 CORE_ADDR *ptr, CORE_ADDR *ptr_addr);
122 /* If FILENAME refers to an ELF shared object then attempt to return the
123 string referred to by its DT_SONAME tag. */
125 extern gdb::unique_xmalloc_ptr<char> gdb_bfd_read_elf_soname
126 (const char *filename);
128 /* Enable or disable optional solib event breakpoints as appropriate. */
130 extern void update_solib_breakpoints (void);
132 /* Handle an solib event by calling solib_add. */
134 extern void handle_solib_event (void);
136 /* Associate SONAME with BUILD_ID in ABFD's registry so that it can be
137 retrieved with get_cbfd_soname_build_id. */
139 extern void set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd,
140 const char *soname,
141 const bfd_build_id *build_id);
143 /* If SONAME had a build-id associated with it in ABFD's registry by a
144 previous call to set_cbfd_soname_build_id then return the build-id
145 as a NULL-terminated hex string. */
147 extern gdb::unique_xmalloc_ptr<char> get_cbfd_soname_build_id
148 (gdb_bfd_ref_ptr abfd, const char *soname);
150 #endif /* SOLIB_H */