public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org>
Cc: Tom Tromey <tom@tromey.com>,  Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH] gdb: add Python events for program space addition and removal
Date: Wed, 27 Sep 2023 08:20:04 -0600	[thread overview]
Message-ID: <87h6nf4s17.fsf@tromey.com> (raw)
In-Reply-To: <87r0mjx514.fsf@redhat.com> (Andrew Burgess via Gdb-patches's message of "Wed, 27 Sep 2023 11:51:51 +0100")

>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:

>> This approach seems totally fine to me, but it's worth noting that you
>> could attach data directly to a Progspace if the tp_hash field were
>> filled in.  Some other Python classes in gdb do this.  This makes caches
>> easier because the cleanup is automatic.

Andrew> I'm not sure I understand how tp_hash helps here?

Yeah, I meant tp_dictoffset ...

Andrew> gdb.Progspace does have a __dict__ attribute, so things like:

... which is already set.  Sorry about that.

Andrew> works just fine, and I did consider this.  But I wasn't sure if this was
Andrew> "good practice".  My concern was mostly that this might lead to clashes
Andrew> between different extensions if good names are not chosen for
Andrew> 'my_random_var', or even clashes between extensions and future GDB
Andrew> enhancements -- my understanding is that if we later added
Andrew> 'my_random_var' as a builtin attribute this would take precedence over
Andrew> the user defined attribute, breaking their extension.

Yeah.  gdb should promise not to use "_" names here & in other spots
using tp_dictoffset.

Tom

  reply	other threads:[~2023-09-27 14:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 12:44 Andrew Burgess
2023-09-21 19:20 ` Tom Tromey
2023-09-27 10:51   ` Andrew Burgess
2023-09-27 14:20     ` Tom Tromey [this message]
2023-09-27 15:17       ` Andrew Burgess
2023-09-27 15:16 ` [PATCHv2] " Andrew Burgess
2023-09-29 12:41   ` Eli Zaretskii
2023-09-29 13:24   ` [PATCHv3] " Andrew Burgess
2023-09-29 15:46     ` Eli Zaretskii
2023-10-02 16:09       ` Andrew Burgess
2023-10-02 18:34     ` Simon Marchi
2023-10-02 20:36       ` Andrew Burgess
2023-10-02 20:38         ` Simon Marchi
2023-10-02 21:17           ` Andrew Burgess
2023-10-02 20:11     ` [PUSHED] gdb/python: reformat file with black 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=87h6nf4s17.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=aburgess@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).