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