From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] gdb/python: make more use of RegisterDescriptors
Date: Fri, 24 Jul 2020 12:38:21 -0600 [thread overview]
Message-ID: <87365gdahu.fsf@tromey.com> (raw)
In-Reply-To: <ec85a6d5476012b0fc59192039e8d1fbff029d15.1595584512.git.andrew.burgess@embecosm.com> (Andrew Burgess's message of "Fri, 24 Jul 2020 10:57:52 +0100")
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
Andrew> This commit unifies all of the Python register lookup code (used by
Andrew> Frame.read_register, PendingFrame.read_register, and
Andrew> gdb.UnwindInfo.add_saved_register), and adds support for using a
Andrew> gdb.RegisterDescriptor for register lookup.
Thanks for doing this. This approach seems good to me.
Andrew> +other two methods as @value{GDBN} must lookup the mapping between name
I'd suggest "look up" here.
Andrew> +/* See python-internal.h. */
Andrew> +
Andrew> +bool
Andrew> +gdbpy_parse_register_id (struct gdbarch *gdbarch, PyObject *pyo_reg_id,
Andrew> + int *reg_num)
Andrew> +{
Andrew> + if (pyo_reg_id == NULL)
Andrew> + return false;
I think this function should consistently set the Python error when
returning false.
Andrew> + if (gdbpy_is_string (pyo_reg_id))
Andrew> + {
Andrew> + gdb::unique_xmalloc_ptr<char> reg_name (gdbpy_obj_to_string (pyo_reg_id));
... gdbpy_obj_to_string will set the Python error when it returns NULL.
Andrew> + if (gdb_py_int_as_long (pyo_reg_id, &value) && (int) value == value)
gdb_py_int_as_long can set the error as well.
Tom
prev parent reply other threads:[~2020-07-24 18:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 9:57 [PATCH 0/2] Allow gdb.RegisterDescriptors to be used in read_register calls Andrew Burgess
2020-07-24 9:57 ` [PATCH 1/2] gdb: Add a find method for RegisterDescriptorIterator Andrew Burgess
2020-07-24 10:32 ` Eli Zaretskii
2020-07-24 23:17 ` Andrew Burgess
2020-07-25 6:27 ` Eli Zaretskii
2020-07-24 18:22 ` Tom Tromey
2020-07-24 9:57 ` [PATCH 2/2] gdb/python: make more use of RegisterDescriptors Andrew Burgess
2020-07-24 10:36 ` Eli Zaretskii
2020-07-24 18:38 ` Tom Tromey [this message]
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=87365gdahu.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