]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/solib.h
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / solib.h
CommitLineData
c906108c 1/* Shared library declarations for GDB, the GNU Debugger.
fcb335b0 2
1d506c26 3 Copyright (C) 1992-2024 Free Software Foundation, Inc.
c906108c 4
c5aa993b 5 This file is part of GDB.
c906108c 6
c5aa993b
JM
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
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
c5aa993b 10 (at your option) any later version.
c906108c 11
c5aa993b
JM
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.
c906108c 16
c5aa993b 17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c 19
010f3b2f
JT
20#ifndef SOLIB_H
21#define SOLIB_H
22
104c1213 23/* Forward decl's for prototypes */
7b323785 24struct solib;
c906108c 25struct target_ops;
6cedf3bc 26struct solib_ops;
6c95b8df 27struct program_space;
c906108c 28
fcb335b0 29#include "gdb_bfd.h"
b15cc25c 30#include "symfile-add-flags.h"
6b3a2759 31#include "gdbsupport/function-view.h"
b15cc25c 32
e26d0dab
SM
33/* Value of the 'set debug solib' configuration variable. */
34
35extern bool debug_solib;
36
37/* Print an "solib" debug statement. */
38
39#define solib_debug_printf(fmt, ...) \
40 debug_prefixed_printf_cond (debug_solib, "solib", fmt, ##__VA_ARGS__)
41
42#define SOLIB_SCOPED_DEBUG_START_END(fmt, ...) \
43 scoped_debug_start_end (debug_solib, "solib", fmt, ##__VA_ARGS__)
44
c1663e36
SM
45/* Called when we free all symtabs of PSPACE, to free the shared library
46 information as well. */
c906108c 47
c1663e36 48extern void clear_solib (program_space *pspace);
c906108c 49
c378eb4e 50/* Called to add symbols from a shared library to gdb's symbol table. */
c906108c 51
e696b3ad 52extern void solib_add (const char *, int, int);
7b323785 53extern bool solib_read_symbols (solib &, symfile_add_flags);
c906108c 54
7095b863
MS
55/* Function to be called when the inferior starts up, to discover the
56 names of shared libraries that are dynamically linked, the base
57 addresses to which they are linked, and sufficient information to
58 read in their symbols at a later time. */
c906108c 59
268a4a75 60extern void solib_create_inferior_hook (int from_tty);
c906108c
SS
61
62/* If ADDR lies in a shared library, return its name. */
63
6d08aed3 64extern const char *solib_name_from_address (struct program_space *, CORE_ADDR);
c906108c 65
5b89c67a 66/* Return true if ADDR lies within SOLIB. */
5fd1a349 67
7b323785 68extern bool solib_contains_address_p (const solib &, CORE_ADDR);
5fd1a349 69
de18c1d8
JM
70/* Return whether the data starting at VADDR, size SIZE, must be kept
71 in a core file for shared libraries loaded before "gcore" is used
72 to be handled correctly when the core file is loaded. This only
73 applies when the section would otherwise not be kept in the core
74 file (in particular, for readonly sections). */
75
5b89c67a 76extern bool solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size);
de18c1d8 77
5b89c67a 78/* Return true if PC lies in the dynamic symbol resolution code of the
d7fa2ae2 79 run time loader. */
c906108c 80
5b89c67a 81extern bool in_solib_dynsym_resolve_code (CORE_ADDR);
1dd1751e 82
c378eb4e 83/* Discard symbols that were auto-loaded from shared libraries. */
cb0ba49e 84
0b39b52e 85extern void no_shared_libraries (const char *ignored, int from_tty);
010f3b2f 86
51457a05
MAL
87/* Synchronize GDB's shared object list with inferior's.
88
89 Extract the list of currently loaded shared objects from the
a1fd1ac9
TT
90 inferior, and compare it with the list of shared objects in the
91 current program space's list of shared libraries. Edit
92 so_list_head to bring it in sync with the inferior's new list.
51457a05
MAL
93
94 If we notice that the inferior has unloaded some shared objects,
95 free any symbolic info GDB had read about those shared objects.
96
97 Don't load symbolic info for any new shared objects; just add them
98 to the list, and leave their symbols_loaded flag clear.
99
100 If FROM_TTY is non-null, feel free to print messages about what
101 we're doing. */
102
103extern void update_solib_list (int from_tty);
104
5b89c67a 105/* Return true if NAME is the libpthread shared library. */
17a37d48 106
5b89c67a 107extern bool libpthread_name_p (const char *name);
17a37d48 108
cb457ae2
YQ
109/* Look up symbol from both symbol table and dynamic string table. */
110
6b3a2759
TT
111extern CORE_ADDR gdb_bfd_lookup_symbol
112 (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym);
cb457ae2
YQ
113
114/* Look up symbol from symbol table. */
115
6b3a2759
TT
116extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab
117 (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym);
cb457ae2 118
8ddf4645
AM
119/* Scan for DESIRED_DYNTAG in .dynamic section of ABFD. If DESIRED_DYNTAG is
120 found, 1 is returned and the corresponding PTR and PTR_ADDR are set. */
121
122extern int gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd,
123 CORE_ADDR *ptr, CORE_ADDR *ptr_addr);
124
39f53acb
AM
125/* If FILENAME refers to an ELF shared object then attempt to return the
126 string referred to by its DT_SONAME tag. */
127
128extern gdb::unique_xmalloc_ptr<char> gdb_bfd_read_elf_soname
129 (const char *filename);
130
f9e14852
GB
131/* Enable or disable optional solib event breakpoints as appropriate. */
132
133extern void update_solib_breakpoints (void);
134
135/* Handle an solib event by calling solib_add. */
136
137extern void handle_solib_event (void);
138
39f53acb
AM
139/* Associate SONAME with BUILD_ID in ABFD's registry so that it can be
140 retrieved with get_cbfd_soname_build_id. */
141
142extern void set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd,
143 const char *soname,
144 const bfd_build_id *build_id);
145
010f3b2f 146#endif /* SOLIB_H */