Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Guinevere Larsen <guinevere@redhat.com>,
	Simon Marchi <simon.marchi@efficios.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH v3 5/6] gdb/progspace: add solib_ops pointer in program_space
Date: Tue, 17 Jun 2025 16:33:27 -0400	[thread overview]
Message-ID: <1085bd17-956a-449a-bb9d-eb89a90ac7fc@simark.ca> (raw)
In-Reply-To: <ebf9177c-b341-4371-8f05-4e65ef6726d8@redhat.com>

On 6/17/25 3:45 PM, Guinevere Larsen wrote:
> On 6/16/25 4:33 PM, Simon Marchi wrote:
>> New in v3:
>>
>>   - add some ops nullptr checks in print_solib_list_table and
>>     info_linker_namespace_command
>>
>> The subsequent C++ification patch in this series will allocate one
>> instance of solib_ops per program space.  That instance will be held in
>> struct program_space.  As a small step towards this, add an `solib_ops
>> *` field to `struct program_space`.  This field represents the solib_ops
>> currently used to manage the solibs in that program space.  Initialize
>> it with the result of `gdbarch_so_ops` in `post_create_inferior`, and
>> use it whenever we need to do some solib stuff, rather than using
>> `gdbarch_so_ops` directly.
>>
>> The difficulty here is knowing when exactly to set and unset the solib
>> ops.  What I have here passes the testsuite on Linux, but with more
>> testing we will probably discover more spots where it's needed.
>>
>> The C++ification patch will turn this field into a unique pointer.
>>
>> With this patch, the message we get when running "info
>> linker-namespaces" becomes always the same, so update the test in
>> gdb.base/dlmopen-ns-ids.exp.
>>
>> Change-Id: Ide8ddc57328895720fcd645d46dc34491f84c656
> 
> Thanks for working on this series! I have one very minor nit in this patch, but with that fixes, you can feel free to add my review tag
> 
> Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
> 
> Feel free to add it to patches 1-4 as well, as I looked over them and they all LGTM. I still don't feel qualified to offer it for patch 6, though.

Thank you!

Given your review, I plan to push this series probably tomorrow.  You
can start rebasing and adjusting your series on top, and then I can
hopefully review it this week (note that I'm off this Friday, so it
would have to be Thursday max).

>> @@ -1021,16 +1024,21 @@ print_solib_list_table (std::vector<const solib *> solib_list,
>>     gdbarch *gdbarch = current_inferior ()->arch ();
>>     /* "0x", a little whitespace, and two hex digits per byte of pointers.  */
>>     int addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4);
>> -  const solib_ops *ops = gdbarch_so_ops (gdbarch);
>> +  const solib_ops *ops = current_program_space->solib_ops ();
>>     struct ui_out *uiout = current_uiout;
>>     bool so_missing_debug_info = false;
>>   +  if (ops == nullptr)
>> +    return;
>> +
>>     /* There are 3 conditions for this command to print solib namespaces,
>>        first PRINT_NAMESPACE has to be true, second the solib_ops has to
>>        support multiple namespaces, and third there must be more than one
>>        active namespace.  Fold all these into the PRINT_NAMESPACE condition.  */
>> -  print_namespace = print_namespace && ops->num_active_namespaces != nullptr
>> -            && ops->num_active_namespaces () > 1;
>> +  print_namespace = (print_namespace
>> +             && ops != nullptr
>
> This check is redundant with the previous early exit. The only reason
> I bring this up is because the comment brings up "3 conditions" but
> there are 4 checks in this expression. The comment isn't wrong, but it
> does the code confusing until you figure out that checking if
> solib_ops is present isn't one of the conditions.

You're right, it's redundant, I'll fix it.  Note to self: returning
early means that the table will not be output at all.  Check if
returning early is a problem for e.g. MI, when the inferior is not
running.

Simon

  reply	other threads:[~2025-06-17 20:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 19:32 [PATCH v3 1/6] gdb/testsuite: check that "info shared" and "info linker-namespaces" before running don't crash Simon Marchi
2025-06-16 19:33 ` [PATCH v3 2/6] gdb/solib: fix formatting of "info linker-namespaces" error message Simon Marchi
2025-06-20 18:12   ` Pedro Alves
2025-06-26 17:35     ` Simon Marchi
2025-06-16 19:33 ` [PATCH v3 3/6] gdb/solib: add solib -> solib_ops backlink Simon Marchi
2025-06-20 18:17   ` Pedro Alves
2025-06-16 19:33 ` [PATCH v3 4/6] gdb/solib: use solib::ops for operations that concern a single solib Simon Marchi
2025-06-20 18:17   ` Pedro Alves
2025-06-16 19:33 ` [PATCH v3 5/6] gdb/progspace: add solib_ops pointer in program_space Simon Marchi
2025-06-17 19:45   ` Guinevere Larsen
2025-06-17 20:33     ` Simon Marchi [this message]
2025-06-18 11:51       ` Guinevere Larsen
2025-06-18 14:43         ` Simon Marchi
2025-06-18 15:01           ` Guinevere Larsen
2025-06-20 18:19   ` Pedro Alves
2025-06-26 17:37     ` Simon Marchi
2025-09-02 14:49   ` Tom de Vries
2025-09-02 16:05     ` Simon Marchi
2025-09-02 16:34       ` Tom de Vries
2025-06-16 19:33 ` [PATCH v3 6/6] gdb/solib: C++ify solib_ops Simon Marchi
2025-06-20 18:20   ` Pedro Alves
2025-06-26 18:04     ` Simon Marchi
2025-06-27 22:04       ` Tom de Vries
2025-06-27 22:46         ` Thiago Jung Bauermann
2025-06-28  5:25           ` Simon Marchi
2025-06-28  6:27             ` Tom de Vries
2025-06-20 18:12 ` [PATCH v3 1/6] gdb/testsuite: check that "info shared" and "info linker-namespaces" before running don't crash Pedro Alves
2025-06-26 17:30   ` 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=1085bd17-956a-449a-bb9d-eb89a90ac7fc@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.com \
    --cc=simon.marchi@efficios.com \
    /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