From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb/python: Reuse gdb.RegisterDescriptor objects where possible
Date: Mon, 13 Jul 2020 12:21:41 -0600 [thread overview]
Message-ID: <871rlf8edm.fsf@tromey.com> (raw)
In-Reply-To: <325856d3d21fd0f417d4ec0bfd9b233c0190c780.1594197735.git.andrew.burgess@embecosm.com> (Andrew Burgess's message of "Wed, 8 Jul 2020 09:48:11 +0100")
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
Andrew> * python/py-registers.c (gdbpy_register_object_data): New static
Andrew> global.
Andrew> (gdbpy_register_object_data_init): New function.
Andrew> (gdbpy_new_register_descriptor): Renamed to...
Andrew> (gdbpy_get_register_descriptor): ...this, and update to reuse
Andrew> existing register descriptors where possible.
Andrew> (gdbpy_register_descriptor_iter_next): Update.
Andrew> (gdbpy_initialize_registers): Register new gdbarch data.
This looks reasonable to me.
Andrew> +static void *
Andrew> +gdbpy_register_object_data_init (struct gdbarch *gdbarch)
Andrew> +{
Andrew> + std::vector<const register_descriptor_object *> *vec
Andrew> + = new (std::vector<const register_descriptor_object *>);
Andrew> + return (void *) vec;
It seems a bit strange to use "const" here, since the refcounts do
change, and the code has to cast away const elsewhere.
Also I wonder if a vector of PyObject* or even gdb_pyref<> would be
better.
Tom
next prev parent reply other threads:[~2020-07-13 18:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 8:48 [PATCH 0/2] Improvements to Python Register Descriptor API Andrew Burgess
2020-07-08 8:48 ` [PATCH 1/2] gdb/python: Reuse gdb.RegisterDescriptor objects where possible Andrew Burgess
2020-07-13 18:21 ` Tom Tromey [this message]
2020-07-08 8:48 ` [PATCH 2/2] gdb/python: Reuse gdb.RegisterGroup " Andrew Burgess
2020-07-13 18:23 ` Tom Tromey
2020-07-14 17:14 ` [PATCHv2 0/2] Improvements to Python Register Descriptor API Andrew Burgess
2020-07-14 17:14 ` [PATCHv2 1/2] gdb/python: Reuse gdb.RegisterDescriptor objects where possible Andrew Burgess
2020-07-22 13:10 ` Pedro Alves
2020-07-22 14:05 ` Andrew Burgess
2020-07-22 14:32 ` Pedro Alves
2020-07-22 15:10 ` Andrew Burgess
2020-07-14 17:14 ` [PATCHv2 2/2] gdb/python: Reuse gdb.RegisterGroup " Andrew Burgess
2020-07-21 18:26 ` [PATCHv2 0/2] Improvements to Python Register Descriptor API Tom Tromey
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=871rlf8edm.fsf@tromey.com \
--to=tom@tromey.com \
--cc=andrew.burgess@embecosm.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).