Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 3/4] gdb: Have setter and getter callbacks for settings
Date: Wed, 11 Aug 2021 20:00:39 +0000	[thread overview]
Message-ID: <20210811195946.ls3e2d2sbpt24o2e@ubuntu.lan> (raw)
In-Reply-To: <7de0a03d-77bf-3b09-9a11-4a109afce8a8@polymtl.ca>

> Another option would be to use
> 
>   gdb::optional<setting> var;
> 
> in cmd_list_element, and make it such that a setting can never exist in
> an invalid state.  Two constructor would exist, one to construct a
> setting with a pointer to a buffer and another with the setter/getter.
> There would be no need (I think) for set_p and set_accessors.

This approach would be a problem within param_smob
(gdb/guile/scm-param.c). This struct is memset initialized, so we cannot
have one of its member which is not a PODType (see the redefinition of
memset in gdbsupport/poison.h).  We could have a pointer to a properly
constructed setting within a param_smob plus some manual memory
management, but I am not sure it is worth it.

> 
> But otherwise, `valid` sounds good to me as well.

I’ll go for that.

Lancelot.
> 
> Simon

  reply	other threads:[~2021-08-11 20:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08 19:22 [PATCH v2 0/4] gdb: Refactor cmd_list_element.var Lancelot SIX via Gdb-patches
2021-08-08 19:22 ` [PATCH v2 1/4] gdb: Add typesafe getter/setter for cmd_list_element.var Lancelot SIX via Gdb-patches
2021-08-10  1:29   ` Simon Marchi via Gdb-patches
2021-08-10 12:22   ` Simon Marchi via Gdb-patches
2021-08-10 21:58     ` Lancelot SIX via Gdb-patches
2021-08-11  0:56       ` Simon Marchi via Gdb-patches
2021-08-08 19:23 ` [PATCH v2 2/4] gdb: make string-like set show commands use std::string variable Lancelot SIX via Gdb-patches
2021-08-08 19:23 ` [PATCH v2 3/4] gdb: Have setter and getter callbacks for settings Lancelot SIX via Gdb-patches
2021-08-10  3:01   ` Simon Marchi via Gdb-patches
2021-08-10 22:18     ` Lancelot SIX via Gdb-patches
2021-08-11  1:01       ` Simon Marchi via Gdb-patches
2021-08-11 20:00         ` Lancelot SIX via Gdb-patches [this message]
2021-08-19 21:03           ` Simon Marchi via Gdb-patches
2021-08-20  7:04             ` Lancelot SIX via Gdb-patches
2021-08-08 19:23 ` [PATCH v2 4/4] gdb: Setting setter return a bool to tell if the value changed Lancelot SIX via Gdb-patches

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=20210811195946.ls3e2d2sbpt24o2e@ubuntu.lan \
    --to=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    --cc=simon.marchi@polymtl.ca \
    /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