public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Lancelot SIX <lsix@lancelotsix.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 15/16] gdb: make cmd_list_element var an optional union
Date: Fri, 23 Jul 2021 22:04:22 -0400	[thread overview]
Message-ID: <902d2087-7ff6-2f4c-cb00-03230c4ca68f@polymtl.ca> (raw)
In-Reply-To: <20210723225536.vldk332x4be7czts@ubuntu.lan>

> Yes, the usage seems to be quite close (from the command writer point of
> view).  The major diferences at the momment is:
> - Your setter returns a bool to let know the caller that the setting has
>   been updated where mine does not.  I should change that.

Returning a bool is necessary to be able to tell whether we should emit
an MI =param-changed notification or not.  I think that's the only use.

> Other than that, you should be able to fit your set_inferior_tty_command
> and get_inferior_tty (among others) in my framework quite easily, in a
> very similar way.
> 
> Your add_setshow_*_cmd are changed from something like
> 
>   commands.set->function.set_cmd.set_func.string = set_func;
>   commands.show->function.show_cmd.get_func.string = get_func;
> 
> to something like
> 
>   commands.set->var.set_accessor<var_filename> (set_func, get_func);
>   commands.show->var.set_accessor<var_filename> (set_func, get_func);

Great!

> (I should probably not set both accessors with one function, only one
> will ever be used).

Just for the sake of discussion:

Conceptually, I find it a little bit wrong that settings are "part" of
the set and show commands.  Ideally, I think a setting (or parameter,
the two terms are used almost interchangeably) should be decoupled from
the set/show commands.  There are various ways to read setting values,
show commands are just one of them.  So, every time some part of GDB
needs to look up a setting, it actually looks up the corresponding show
command.  I think that settings should be kept in their own registry,
indexed by name.  You would have one setting instance for "non-stop",
for example, with a getter and a setter function.  The "set non-stop"
and "show non-stop" cmd_list_element objects would both point to this
instance and use the setting's setter or getter function.

Other parts of GDB that need to access settings, like the gdb.parameter
Python function, would look up the settings registry.  For example,
gdb.parameter('non-stop') would look up 'non-stop' in that registry, and
not look up the 'show non-stop' command as it does today.

>> Also, could you provide a git branch with your latest patch?  It will be
>> easier than figuring out on what to apply it.
> 
> I have pushed my current work (still a work in progress) to the
> following branch on sourceware: users/lsix/refactor-typesafe-var.

Thanks!

Simon

  reply	other threads:[~2021-07-24  2:05 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  4:55 [PATCH 00/16] Bunch of commands related cleanups Simon Marchi
2021-07-14  4:55 ` [PATCH 01/16] gdb/testsuite: split gdb.python/py-parameter.exp in procs Simon Marchi
2021-07-14  4:55 ` [PATCH 02/16] gdb.base/setshow.exp: use save_vars to save/restore gdb_prompt Simon Marchi
2021-07-14  4:55 ` [PATCH 03/16] gdb.base/setshow.exp: split in procs Simon Marchi
2021-07-14  4:55 ` [PATCH 04/16] gdb.base/setshow.exp: fix duplicate test name Simon Marchi
2021-07-14  4:55 ` [PATCH 05/16] gdb: un-share set_inferior_cwd declaration Simon Marchi
2021-07-14  4:55 ` [PATCH 06/16] gdb: remove inferior::{argc,argv} Simon Marchi
2021-07-14  4:55 ` [PATCH 07/16] gdb: add setter/getter for inferior arguments Simon Marchi
2021-07-14  4:55 ` [PATCH 08/16] gdb: add setter/getter for inferior cwd Simon Marchi
2021-07-14  4:55 ` [PATCH 09/16] gdb: make inferior::m_args an std::string Simon Marchi
2021-07-14  4:55 ` [PATCH 10/16] gdb: make inferior::m_cwd " Simon Marchi
2021-07-14  4:55 ` [PATCH 11/16] gdb: make inferior::m_terminal " Simon Marchi
2021-07-14  4:55 ` [PATCH 12/16] gdb: rename cfunc to simple_func Simon Marchi
2021-07-14  4:55 ` [PATCH 13/16] gdb: remove cmd_list_element::function::sfunc Simon Marchi
2021-07-28 19:10   ` Tom Tromey
2021-07-28 21:17     ` Simon Marchi
2021-07-29 17:33       ` Tom Tromey
2021-07-14  4:55 ` [PATCH 14/16] gdb/testsuite: test get/set value of unregistered Guile parameter Simon Marchi
2021-07-23 19:42   ` Simon Marchi
2021-07-14  4:55 ` [PATCH 15/16] gdb: make cmd_list_element var an optional union Simon Marchi
2021-07-14 12:08   ` Lancelot SIX
2021-07-14 17:12     ` Lancelot SIX
2021-07-14 19:22       ` Simon Marchi
2021-07-14 23:22         ` Lancelot SIX
2021-07-19 14:32           ` Simon Marchi
2021-07-19 19:52             ` Simon Marchi
2021-07-20 23:03               ` Lancelot SIX
2021-07-23 19:56                 ` Simon Marchi
2021-07-23 20:46                   ` Lancelot SIX
2021-07-23 21:15                     ` Simon Marchi
2021-07-23 22:55                       ` Lancelot SIX
2021-07-24  2:04                         ` Simon Marchi [this message]
2021-07-28 20:13                 ` Tom Tromey
2021-07-28 20:45                   ` Lancelot SIX
2021-07-29 17:47                     ` Tom Tromey
2021-07-29 20:12                       ` Lancelot SIX
2021-07-30  2:09                         ` Simon Marchi
2021-07-30 17:47                           ` Lancelot SIX
2021-07-18 15:44   ` Lancelot SIX
2021-07-19 14:19     ` Simon Marchi
2021-07-19 20:58       ` Lancelot SIX
2021-07-28 19:47   ` Tom Tromey
2021-07-28 20:59     ` Simon Marchi
2021-07-29 17:41       ` Tom Tromey
2021-07-29 17:44         ` Simon Marchi
2021-07-29 17:49           ` Tom Tromey
2021-07-29 18:00             ` Simon Marchi
2021-07-14  4:55 ` [PATCH 16/16] gdb: make string-like set show commands use std::string variable Simon Marchi
2021-07-28 20:27   ` Tom Tromey
2021-07-28 21:03     ` Simon Marchi

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=902d2087-7ff6-2f4c-cb00-03230c4ca68f@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).