| 1 | /* Shared library declarations for GDB, the GNU Debugger. |
| 2 | |
| 3 | Copyright (C) 1992-2020 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 */ |
| 24 | struct so_list; |
| 25 | struct target_ops; |
| 26 | struct target_so_ops; |
| 27 | struct program_space; |
| 28 | |
| 29 | #include "symfile-add-flags.h" |
| 30 | |
| 31 | /* Called when we free all symtabs, to free the shared library information |
| 32 | as well. */ |
| 33 | |
| 34 | extern void clear_solib (void); |
| 35 | |
| 36 | /* Called to add symbols from a shared library to gdb's symbol table. */ |
| 37 | |
| 38 | extern void solib_add (const char *, int, int); |
| 39 | extern bool solib_read_symbols (struct so_list *, symfile_add_flags); |
| 40 | |
| 41 | /* Function to be called when the inferior starts up, to discover the |
| 42 | names of shared libraries that are dynamically linked, the base |
| 43 | addresses to which they are linked, and sufficient information to |
| 44 | read in their symbols at a later time. */ |
| 45 | |
| 46 | extern void solib_create_inferior_hook (int from_tty); |
| 47 | |
| 48 | /* If ADDR lies in a shared library, return its name. */ |
| 49 | |
| 50 | extern char *solib_name_from_address (struct program_space *, CORE_ADDR); |
| 51 | |
| 52 | /* Return true if ADDR lies within SOLIB. */ |
| 53 | |
| 54 | extern bool solib_contains_address_p (const struct so_list *, CORE_ADDR); |
| 55 | |
| 56 | /* Return whether the data starting at VADDR, size SIZE, must be kept |
| 57 | in a core file for shared libraries loaded before "gcore" is used |
| 58 | to be handled correctly when the core file is loaded. This only |
| 59 | applies when the section would otherwise not be kept in the core |
| 60 | file (in particular, for readonly sections). */ |
| 61 | |
| 62 | extern bool solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size); |
| 63 | |
| 64 | /* Return true if PC lies in the dynamic symbol resolution code of the |
| 65 | run time loader. */ |
| 66 | |
| 67 | extern bool in_solib_dynsym_resolve_code (CORE_ADDR); |
| 68 | |
| 69 | /* Discard symbols that were auto-loaded from shared libraries. */ |
| 70 | |
| 71 | extern void no_shared_libraries (const char *ignored, int from_tty); |
| 72 | |
| 73 | /* Set the solib operations for GDBARCH to NEW_OPS. */ |
| 74 | |
| 75 | extern void set_solib_ops (struct gdbarch *gdbarch, |
| 76 | const struct target_so_ops *new_ops); |
| 77 | |
| 78 | /* Synchronize GDB's shared object list with inferior's. |
| 79 | |
| 80 | Extract the list of currently loaded shared objects from the |
| 81 | inferior, and compare it with the list of shared objects in the |
| 82 | current program space's list of shared libraries. Edit |
| 83 | so_list_head to bring it in sync with the inferior's new list. |
| 84 | |
| 85 | If we notice that the inferior has unloaded some shared objects, |
| 86 | free any symbolic info GDB had read about those shared objects. |
| 87 | |
| 88 | Don't load symbolic info for any new shared objects; just add them |
| 89 | to the list, and leave their symbols_loaded flag clear. |
| 90 | |
| 91 | If FROM_TTY is non-null, feel free to print messages about what |
| 92 | we're doing. */ |
| 93 | |
| 94 | extern void update_solib_list (int from_tty); |
| 95 | |
| 96 | /* Return true if NAME is the libpthread shared library. */ |
| 97 | |
| 98 | extern bool libpthread_name_p (const char *name); |
| 99 | |
| 100 | /* Look up symbol from both symbol table and dynamic string table. */ |
| 101 | |
| 102 | extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd, |
| 103 | int (*match_sym) (const asymbol *, |
| 104 | const void *), |
| 105 | const void *data); |
| 106 | |
| 107 | /* Look up symbol from symbol table. */ |
| 108 | |
| 109 | extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd, |
| 110 | int (*match_sym) |
| 111 | (const asymbol *, |
| 112 | const void *), |
| 113 | const void *data); |
| 114 | |
| 115 | /* Enable or disable optional solib event breakpoints as appropriate. */ |
| 116 | |
| 117 | extern void update_solib_breakpoints (void); |
| 118 | |
| 119 | /* Handle an solib event by calling solib_add. */ |
| 120 | |
| 121 | extern void handle_solib_event (void); |
| 122 | |
| 123 | #endif /* SOLIB_H */ |