Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCHv2 1/3] gdb/python: introduce gdb.Corefile API
Date: Mon, 06 Oct 2025 09:54:42 +0100	[thread overview]
Message-ID: <87sefw76lp.fsf@redhat.com> (raw)
In-Reply-To: <87h5wf7r1q.fsf@tromey.com>

Tom Tromey <tom@tromey.com> writes:

>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> This commit starts adding some core file related features to the
> Andrew> Python API.
>
> Thanks.
>
> Andrew> +/* Store a gdb.Corefile object in an inferior's registry.  */
> Andrew> +
> Andrew> +static const registry<inferior>::key<corefile_object,
> Andrew> +				     inferior_corefile_deleter>
> Andrew> +     cfpy_inferior_corefile_data_key;
>
> I suspect this should now use the new python-specific registry
> approaches, see gdbpy_registry.

I took a look at this, and I don't think gdbpy_registry is the right
solution.

  1. It is designed to hold objects which are stored on either an
     objfile or a gdbarch, e.g. types.  The use of templates allows us
     to avoid the duplication needed to deal with accessing the same
     type of "thing" either from the objfile or the gdbarch.  In my case
     I need to store on the inferior.

  2. It is designed for cases where each objfile or gdbarch can hold
     many "things" of a given type.  E.g. types, as such within each
     registry entry the "things" are stored in some container, like a
     map or set.  In my case each inferior has 0 or 1 associated core
     files, so adding a set or map would be unnecessary.

I'm sure with a little additional effort we _could_ generalise
gdbpy_registry more to make it apply in my case, but I don't think that
would actually add any value.  The existing code, for the cases in which
it applies, serves to remove some duplication.  But for cases like mine,
I don't think gdbpy_registry would remove any code.

The only benefit of extending gdbpy_registry would be that _every_ use
of a registry in Python code could, potentially, be made to use the same
interface.  But at a cost of making that interface more complex (to
handle the different cases).

Let me know your thoughts.

>
> Andrew> +  bfd *abfd= obj->inferior->pspace->core_bfd ();
>
> Nit: missing space before '='.

Fixed.

Thanks,
Andrew


  reply	other threads:[~2025-10-06  8:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02 16:03 [PATCH 0/3] Core file Python API Andrew Burgess
2025-09-02 16:03 ` [PATCH 1/3] gdb/python: introduce gdb.Corefile API Andrew Burgess
2025-09-02 16:26   ` Eli Zaretskii
2025-09-16 17:25   ` Tom Tromey
2025-09-23 13:50     ` Andrew Burgess
2025-09-02 16:03 ` [PATCH 2/3] gdb: make structured core file mappings processing global Andrew Burgess
2025-09-16 17:28   ` Tom Tromey
2025-09-02 16:03 ` [PATCH 3/3] gdb/python: add Corefile.mapped_files method Andrew Burgess
2025-09-16 17:54   ` Tom Tromey
2025-09-23 13:52     ` Andrew Burgess
2025-09-23 13:44 ` [PATCHv2 0/3] Core file Python API Andrew Burgess
2025-09-23 13:44   ` [PATCHv2 1/3] gdb/python: introduce gdb.Corefile API Andrew Burgess
2025-10-03 18:56     ` Tom Tromey
2025-10-06  8:54       ` Andrew Burgess [this message]
2025-10-06 15:39         ` Tom Tromey
2025-10-06 16:13           ` Andrew Burgess
2025-09-23 13:44   ` [PATCHv2 2/3] gdb: make structured core file mappings processing global Andrew Burgess
2025-10-13 13:57     ` Lancelot SIX
2025-10-13 14:37       ` Andrew Burgess
2025-10-13 15:16         ` Six, Lancelot
2025-10-14  9:12         ` Lancelot SIX
2025-09-23 13:44   ` [PATCHv2 3/3] gdb/python: add Corefile.mapped_files method Andrew Burgess
2025-10-03 19:15     ` Tom Tromey
2025-10-07  6:24       ` Tom de Vries
2025-10-07 12:21         ` Andrew Burgess
2025-10-07 13:08           ` Tom de Vries
2025-10-07 13:26             ` Andrew Burgess
2025-10-07 14:38               ` Andrew Burgess
2025-10-07 15:43                 ` Tom de Vries
2025-10-07 16:28                   ` Andrew Burgess
2025-10-08  9:29                     ` Andrew Burgess
2025-10-08 10:36                       ` Tom de Vries
2025-10-08 14:14                         ` Andrew Burgess
2025-10-08 15:43                           ` Tom de Vries
2025-10-08 16:03                             ` Andrew Burgess
2025-10-16 20:00           ` Tom Tromey
2025-10-17 10:02             ` Andrew Burgess
2025-10-17 13:32               ` Andrew Burgess

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=87sefw76lp.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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