From: Pedro Alves <palves@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>,
gdb-patches@sourceware.org
Subject: Re: [RFAv3 0/3] Convenience functions $_gdb_setting/$_gdb_int_setting
Date: Mon, 08 Jul 2019 16:34:00 -0000 [thread overview]
Message-ID: <daea3034-321a-ec8f-c1ee-497821c50499@redhat.com> (raw)
In-Reply-To: <20190706104947.30301-1-philippe.waroquiers@skynet.be>
Hi Philippe,
Some overall design comments below.
On 7/6/19 11:49 AM, Philippe Waroquiers wrote:
> As part of the discussion of 'show | set may-call-functions [on|off]',
> Eli suggested to have a way to access the GDB settings from
> user defined commands.
>
As I had mentioned back then:
https://sourceware.org/ml/gdb-patches/2019-04/msg00562.html
we can already access the settings via Python. E.g. see it
done here from a gdbinit script:
https://gcc.gnu.org/ml/gcc-patches/2019-01/msg00135.html
Copied here for convenience:
python __gcc_prev_pagination=gdb.parameter("pagination")
set pagination off
...
python if __gcc_prev_pagination: gdb.execute("set pagination on")
Given that, and the existence of the "with" command now for the
common case, I'd like to at least see some mention/rationale/argument
in the commit logs about why this is worth having/maintaining
over just using gdb.parameter.
BTW, did you look into how gdb.parameter is implemented, see if
anything could be shared?
BTW², kind of unfortunate that Python used a different naming
here (settings vs parameters).
> So, this patch series implements this.
>
> 2 functions are provided:
> * $_gdb_setting that gives access to all settings, giving back a string value.
> * $_gdb_int_setting, giving access to boolean, auto-boolean and integers.
> This is easier to use for such types than the string version.
The naming of the functions kind of seems a bit reversed to me. Off hand, I'd
expect $_gdb_setting to give me the setting in its native type, and then
something like $_gdb_setting_str to give me a string version/representation.
Also, it seems like a design issue that settings that are unsigned
internally get their values exposed as signed.
I guess it could be even better if the setting's types were some new built-in
types specific for the settings, and then if you wanted to get a string
representation, you'd use '$_as_string($_gdb_setting(...))'. (*)
(*) this made me wonder about a special $_python convenience function,
which would take some python code as argument, and return a value, so you
could write:
if $_python(gdb.parameter ("pagination"))
...
end
etc.
> This is v3.
> Compared to v1, it rebases to a recent master, and handles the comments
> of Eli about the documentation.
>
> (there was in fact no changes between v2 and v1, because I forgot to
> commit the changes before sending the RFAv2 mail).
Thanks,
Pedro Alves
next prev parent reply other threads:[~2019-07-08 16:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-06 10:50 Philippe Waroquiers
2019-07-06 10:50 ` [RFAv3 3/3] NEWS and documentation for $_gdb_setting and $_gdb_int_setting Philippe Waroquiers
2019-07-06 11:22 ` Eli Zaretskii
2019-07-06 10:50 ` [RFAv3 2/3] Test the convenience functions " Philippe Waroquiers
2019-07-06 10:50 ` [RFAv3 1/3] Implement convenience functions to examine GDB settings Philippe Waroquiers
2019-07-08 16:34 ` Pedro Alves [this message]
2019-07-08 22:33 ` [RFAv3 0/3] Convenience functions $_gdb_setting/$_gdb_int_setting Philippe Waroquiers
2019-07-10 15:34 ` Pedro Alves
2019-07-10 22:09 ` Philippe Waroquiers
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=daea3034-321a-ec8f-c1ee-497821c50499@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
/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