aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-02-07 11:53:22 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2024-02-09 11:09:55 -0500
commitc1663e3620dd05657e1abb0b32723b6234519e32 (patch)
tree8a44997a3361e19711144cf2af580101b2032d9c
parent85e8a786f485b1058854af3138f11e0d295ff060 (diff)
downloadgdb-c1663e3620dd05657e1abb0b32723b6234519e32.zip
gdb-c1663e3620dd05657e1abb0b32723b6234519e32.tar.gz
gdb-c1663e3620dd05657e1abb0b32723b6234519e32.tar.bz2
gdb: add program_space parameter to clear_solib
Make the current_program_space reference bubble up one level. Remove one unnecessary declaration of clear_solib. Change-Id: I234e2c8c0b71713364fc7b76cee2bee2b026bd6d Approved-By: Andrew Burgess <aburgess@redhat.com>
-rw-r--r--gdb/corelow.c2
-rw-r--r--gdb/solib.c16
-rw-r--r--gdb/solib.h6
-rw-r--r--gdb/symtab.h4
4 files changed, 12 insertions, 16 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 43c1f69..f291b2a 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -335,7 +335,7 @@ core_target::clear_core ()
/* 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);
}
diff --git a/gdb/solib.c b/gdb/solib.c
index 98cda03..991ff15 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1180,23 +1180,23 @@ solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
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,
@@ -1244,7 +1244,7 @@ no_shared_libraries (const char *ignored, int from_tty)
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 ();
}
diff --git a/gdb/solib.h b/gdb/solib.h
index 6918327..f7a93c0 100644
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -42,10 +42,10 @@ extern bool debug_solib;
#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. */
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 3b067a7..ca5a5b0 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2423,10 +2423,6 @@ extern bool find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
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