From: Simon Marchi Date: Wed, 9 Jul 2025 14:18:46 +0000 (-0400) Subject: gdb/solib-svr4: use program space from solib in find_debug_base_for_solib X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be1410ae9fc0f5e389a19a3b7550013df5bcd9c3;p=thirdparty%2Fbinutils-gdb.git gdb/solib-svr4: use program space from solib in find_debug_base_for_solib 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 --- diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 9b4cabfd5f4..e4542543879 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -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