/* Clear out solib state while the bfd is still open. See
comments in clear_solib in solib.c. */
- clear_solib ();
+ clear_solib (current_program_space);
current_program_space->cbfd.reset (nullptr);
}
return false;
}
-/* Called by free_all_symtabs */
+/* See solib.h. */
void
-clear_solib (void)
+clear_solib (program_space *pspace)
{
const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
- disable_breakpoints_in_shlibs (current_program_space);
+ disable_breakpoints_in_shlibs (pspace);
- current_program_space->so_list.clear_and_dispose ([] (solib *so) {
- notify_solib_unloaded (current_program_space, *so);
- current_program_space->remove_target_sections (so);
+ pspace->so_list.clear_and_dispose ([pspace] (solib *so) {
+ notify_solib_unloaded (pspace, *so);
+ pspace->remove_target_sections (so);
delete so;
});
if (ops->clear_solib != nullptr)
- ops->clear_solib (current_program_space);
+ ops->clear_solib (pspace);
}
/* Shared library startup support. When GDB starts up the inferior,
access to their associated objfiles. Therefore, we can not purge the
solibs' objfiles before clear_solib has been called. */
- clear_solib ();
+ clear_solib (current_program_space);
objfile_purge_solibs ();
}
#define SOLIB_SCOPED_DEBUG_START_END(fmt, ...) \
scoped_debug_start_end (debug_solib, "solib", fmt, ##__VA_ARGS__)
-/* Called when we free all symtabs, to free the shared library information
- as well. */
+/* Called when we free all symtabs of PSPACE, to free the shared library
+ information as well. */
-extern void clear_solib (void);
+extern void clear_solib (program_space *pspace);
/* Called to add symbols from a shared library to gdb's symbol table. */
extern void resolve_sal_pc (struct symtab_and_line *);
-/* solib.c */
-
-extern void clear_solib (void);
-
/* The reason we're calling into a completion match list collector
function. */
enum class complete_symbol_mode