From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH] gdb/solib-svr4: use program space from solib in find_debug_base_for_solib
Date: Wed, 9 Jul 2025 10:18:46 -0400 [thread overview]
Message-ID: <20250709141848.155865-1-simon.marchi@efficios.com> (raw)
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
---
gdb/solib-svr4.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 9b4cabfd5f4b..e45425438790 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
base-commit: 61be4420118b4039b80894ff57ad25f063218bfe
--
2.50.1
next reply other threads:[~2025-07-09 14:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 14:18 Simon Marchi [this message]
2025-07-10 2:44 ` Kevin Buettner
2025-07-11 15:24 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250709141848.155865-1-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox