]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/solib-svr4: use program space from solib in find_debug_base_for_solib
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Jul 2025 14:18:46 +0000 (10:18 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 11 Jul 2025 16:26:25 +0000 (12:26 -0400)
Instead of using the current global program space, I think it makes
sense to fetch the program space from the solib.  The comment for
solib::objfile indicates that it may be nullptr (which is true), but in
this case, the callers (all in
svr4_iterate_over_objfiles_in_search_order) find the solib from an
objfile, so we know that solib::objfile (the link in the opposite
direction) is set for these solibs at this point.

Change-Id: I75037d0b2c39ab1b3a3792432be134e200438efe
Approved-by: Kevin Buettner <kevinb@redhat.com>
gdb/solib-svr4.c

index 9b4cabfd5f4b99a6e444bbfcb768819549d74488..e45425438790b62cb10f0c8ff851cf91693dbf6e 100644 (file)
@@ -3582,7 +3582,10 @@ find_debug_base_for_solib (const solib *solib)
   if (solib == nullptr)
     return 0;
 
-  svr4_info *info = get_svr4_info (current_program_space);
+  /* This is always called for solibs with an associated objfile.  */
+  gdb_assert (solib->objfile != nullptr);
+
+  svr4_info *info = get_svr4_info (solib->objfile->pspace ());
   gdb_assert (info != nullptr);
 
   auto *lm_info