aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-07-22 17:20:22 +0000
committerSimon Marchi <simon.marchi@efficios.com>2024-07-22 13:59:43 -0400
commit7dc9fbb845c2a048191f5045c18e833bb8255977 (patch)
treeddb54a72ad8b78155508ad0c25e333797c581e25 /gdb
parent40578beee8a593e3668852238fd8e9f53790f2c9 (diff)
downloadgdb-7dc9fbb845c2a048191f5045c18e833bb8255977.zip
gdb-7dc9fbb845c2a048191f5045c18e833bb8255977.tar.gz
gdb-7dc9fbb845c2a048191f5045c18e833bb8255977.tar.bz2
gdb/solib: pass program space to solib_used
Make the current program space reference bubble up one level. Change-Id: I6113c9ef57cb31ca8ea129ab58e7c318c09b5123
Diffstat (limited to 'gdb')
-rw-r--r--gdb/solib.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index 8b97cc6..931fa57 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -710,15 +710,16 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
return false;
}
-/* Return true if KNOWN->objfile is used by any other so_list object
- in the list of shared libraries. Return false otherwise. */
+/* Return true if KNOWN->objfile is used by any other solib object
+ in PSPACE's list of shared libraries. Return false otherwise. */
static bool
-solib_used (const solib &known)
+solib_used (program_space *pspace, const solib &known)
{
- for (const solib &pivot : current_program_space->solibs ())
+ for (const solib &pivot : pspace->solibs ())
if (&pivot != &known && pivot.objfile == known.objfile)
return true;
+
return false;
}
@@ -845,7 +846,7 @@ update_solib_list (int from_tty)
/* Unless the user loaded it explicitly, free SO's objfile. */
if (gdb_iter->objfile != nullptr
&& !(gdb_iter->objfile->flags & OBJF_USERLOADED)
- && !solib_used (*gdb_iter))
+ && !solib_used (current_program_space, *gdb_iter))
gdb_iter->objfile->unlink ();
/* Some targets' section tables might be referring to
@@ -1321,7 +1322,7 @@ reload_shared_libraries_1 (int from_tty)
&& filename_cmp (found_pathname, so.so_name.c_str ()) != 0))
{
if (so.objfile && !(so.objfile->flags & OBJF_USERLOADED)
- && !solib_used (so))
+ && !solib_used (current_program_space, so))
so.objfile->unlink ();
current_program_space->remove_target_sections (&so);
so.clear ();