GDB (xrefs)
Loading...
Searching...
No Matches
/tmp/gdb-13.1/gdb/solib.h
Go to the documentation of this file.
1/* Shared library declarations for GDB, the GNU Debugger.
2
3 Copyright (C) 1992-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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.
11
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.
16
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/>. */
19
20#ifndef SOLIB_H
21#define SOLIB_H
22
23/* Forward decl's for prototypes */
24struct so_list;
25struct target_ops;
26struct target_so_ops;
27struct program_space;
28
29#include "gdb_bfd.h"
30#include "symfile-add-flags.h"
31
32/* Value of the 'set debug solib' configuration variable. */
33
34extern bool debug_solib;
35
36/* Print an "solib" debug statement. */
37
38#define solib_debug_printf(fmt, ...) \
39 debug_prefixed_printf_cond (debug_solib, "solib", fmt, ##__VA_ARGS__)
40
41#define SOLIB_SCOPED_DEBUG_START_END(fmt, ...) \
42 scoped_debug_start_end (debug_solib, "solib", fmt, ##__VA_ARGS__)
43
44/* Called when we free all symtabs, to free the shared library information
45 as well. */
46
47extern void clear_solib (void);
48
49/* Called to add symbols from a shared library to gdb's symbol table. */
50
51extern void solib_add (const char *, int, int);
52extern bool solib_read_symbols (struct so_list *, symfile_add_flags);
53
54/* Function to be called when the inferior starts up, to discover the
55 names of shared libraries that are dynamically linked, the base
56 addresses to which they are linked, and sufficient information to
57 read in their symbols at a later time. */
58
59extern void solib_create_inferior_hook (int from_tty);
60
61/* If ADDR lies in a shared library, return its name. */
62
63extern const char *solib_name_from_address (struct program_space *, CORE_ADDR);
64
65/* Return true if ADDR lies within SOLIB. */
66
67extern bool solib_contains_address_p (const struct so_list *, CORE_ADDR);
68
69/* Return whether the data starting at VADDR, size SIZE, must be kept
70 in a core file for shared libraries loaded before "gcore" is used
71 to be handled correctly when the core file is loaded. This only
72 applies when the section would otherwise not be kept in the core
73 file (in particular, for readonly sections). */
74
75extern bool solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size);
76
77/* Return true if PC lies in the dynamic symbol resolution code of the
78 run time loader. */
79
80extern bool in_solib_dynsym_resolve_code (CORE_ADDR);
81
82/* Discard symbols that were auto-loaded from shared libraries. */
83
84extern void no_shared_libraries (const char *ignored, int from_tty);
85
86/* Synchronize GDB's shared object list with inferior's.
87
88 Extract the list of currently loaded shared objects from the
89 inferior, and compare it with the list of shared objects in the
90 current program space's list of shared libraries. Edit
91 so_list_head to bring it in sync with the inferior's new list.
92
93 If we notice that the inferior has unloaded some shared objects,
94 free any symbolic info GDB had read about those shared objects.
95
96 Don't load symbolic info for any new shared objects; just add them
97 to the list, and leave their symbols_loaded flag clear.
98
99 If FROM_TTY is non-null, feel free to print messages about what
100 we're doing. */
101
102extern void update_solib_list (int from_tty);
103
104/* Return true if NAME is the libpthread shared library. */
105
106extern bool libpthread_name_p (const char *name);
107
108/* Look up symbol from both symbol table and dynamic string table. */
109
110extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
111 int (*match_sym) (const asymbol *,
112 const void *),
113 const void *data);
114
115/* Look up symbol from symbol table. */
116
117extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
118 int (*match_sym)
119 (const asymbol *,
120 const void *),
121 const void *data);
122
123/* Scan for DESIRED_DYNTAG in .dynamic section of ABFD. If DESIRED_DYNTAG is
124 found, 1 is returned and the corresponding PTR and PTR_ADDR are set. */
125
126extern int gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd,
127 CORE_ADDR *ptr, CORE_ADDR *ptr_addr);
128
129/* If FILENAME refers to an ELF shared object then attempt to return the
130 string referred to by its DT_SONAME tag. */
131
132extern gdb::unique_xmalloc_ptr<char> gdb_bfd_read_elf_soname
133 (const char *filename);
134
135/* Enable or disable optional solib event breakpoints as appropriate. */
136
137extern void update_solib_breakpoints (void);
138
139/* Handle an solib event by calling solib_add. */
140
141extern void handle_solib_event (void);
142
143/* Associate SONAME with BUILD_ID in ABFD's registry so that it can be
144 retrieved with get_cbfd_soname_build_id. */
145
147 const char *soname,
148 const bfd_build_id *build_id);
149
150/* If SONAME had a build-id associated with it in ABFD's registry by a
151 previous call to set_cbfd_soname_build_id then return the build-id
152 as a NULL-terminated hex string. */
153
154extern gdb::unique_xmalloc_ptr<char> get_cbfd_soname_build_id
155 (gdb_bfd_ref_ptr abfd, const char *soname);
156
157#endif /* SOLIB_H */
const char *const name
Definition: aarch64-tdep.c:67
gdb::ref_ptr< struct bfd, gdb_bfd_ref_policy > gdb_bfd_ref_ptr
Definition: gdb_bfd.h:78
size_t size
Definition: go32-nat.c:241
bool libpthread_name_p(const char *name)
Definition: solib.c:959
bool in_solib_dynsym_resolve_code(CORE_ADDR)
Definition: solib.c:1255
void set_cbfd_soname_build_id(gdb_bfd_ref_ptr abfd, const char *soname, const bfd_build_id *build_id)
Definition: solib.c:499
gdb::unique_xmalloc_ptr< char > get_cbfd_soname_build_id(gdb_bfd_ref_ptr abfd, const char *soname)
Definition: solib.c:518
void solib_create_inferior_hook(int from_tty)
Definition: solib.c:1245
void solib_add(const char *, int, int)
Definition: solib.c:983
void clear_solib(void)
Definition: solib.c:1220
gdb::unique_xmalloc_ptr< char > gdb_bfd_read_elf_soname(const char *filename)
Definition: solib.c:1638
void update_solib_list(int from_tty)
Definition: solib.c:766
CORE_ADDR gdb_bfd_lookup_symbol(bfd *abfd, int(*match_sym)(const asymbol *, const void *), const void *data)
Definition: solib.c:1716
bool debug_solib
Definition: solib.c:60
void no_shared_libraries(const char *ignored, int from_tty)
Definition: solib.c:1277
int gdb_bfd_scan_elf_dyntag(const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, CORE_ADDR *ptr_addr)
Definition: solib.c:1536
const char * solib_name_from_address(struct program_space *, CORE_ADDR)
Definition: solib.c:1193
void update_solib_breakpoints(void)
Definition: solib.c:1291
bool solib_keep_data_in_core(CORE_ADDR vaddr, unsigned long size)
Definition: solib.c:1207
CORE_ADDR gdb_bfd_lookup_symbol_from_symtab(bfd *abfd, int(*match_sym)(const asymbol *, const void *), const void *data)
Definition: solib.c:1481
bool solib_read_symbols(struct so_list *, symfile_add_flags)
Definition: solib.c:695
void handle_solib_event(void)
Definition: solib.c:1302
bool solib_contains_address_p(const struct so_list *, CORE_ADDR)
Definition: solib.c:1168
Definition: solist.h:35