public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4 1/4] gdb: Introduce setting construct within cmd_list_element
Date: Thu, 30 Sep 2021 23:15:58 +0000	[thread overview]
Message-ID: <20210930231558.3ka4vglabsdq4ern@ubuntu.lan> (raw)
In-Reply-To: <f67f207e-cae3-bc14-85d9-f24728ba1da4@polymtl.ca>

> 
> I think the change below should fix it.

Hi,

Sorry for this. I did rebase just few days ago and let this one slip
through.  I’ll fix this and address your other comments shortly.

> 
> Since it's one of those
> settings that reverts the value if the new value is invalid, it could
> eventually be changed to use a getter/setter, so that the setter simply
> rejects the new value if it's not valid.

I’ll do that in separate commit once this series is pushed if this ok
with you. For the moment I’ll just fix the current compile error
with something similar to what you propose bellow.

Thanks a lot for the review.

Best,
Lancelot.

> 
> 
> From 96df63a390451e0bbdfc74784ea09a3aa360656d Mon Sep 17 00:00:00 2001
> From: Simon Marchi <simon.marchi@polymtl.ca>
> Date: Thu, 30 Sep 2021 08:26:41 -0400
> Subject: [PATCH] fix
> 
> Change-Id: Id78157cacf2de9cfacba1f19dea17b0f7b65aa0f
> ---
>  gdb/bt-utils.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c
> index 79e6e090d428..2054e68c6e5a 100644
> --- a/gdb/bt-utils.c
> +++ b/gdb/bt-utils.c
> @@ -29,15 +29,15 @@ gdb_internal_backtrace_set_cmd (const char *args, int from_tty,
>  				cmd_list_element *c)
>  {
>    gdb_assert (c->type == set_cmd);
> -  gdb_assert (c->var_type == var_boolean);
> -  gdb_assert (c->var != nullptr);
> +  gdb_assert (c->var->type () == var_boolean);
> +  gdb_assert (c->var.has_value ());
>  
>  #ifndef GDB_PRINT_INTERNAL_BACKTRACE
> -  bool *var_ptr = (bool *) c->var;
> +  bool val = c->var->get<bool> ();
>  
> -  if (*var_ptr)
> +  if (val)
>      {
> -      *var_ptr = false;
> +      c->var->set<bool> (false);
>        error (_("support for this feature is not compiled into GDB"));
>      }
>  #endif
> -- 
> 2.33.0
> 

  reply	other threads:[~2021-09-30 23:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 21:50 [PATCH v4 0/4] Refactor cmd_list_element.var Lancelot SIX
2021-09-29 21:50 ` [PATCH v4 1/4] gdb: Introduce setting construct within cmd_list_element Lancelot SIX
2021-09-30 12:12   ` Simon Marchi
2021-09-30 12:30     ` Simon Marchi
2021-09-30 23:15       ` Lancelot SIX [this message]
2021-10-01  1:16         ` Simon Marchi
2021-09-30 12:39   ` Simon Marchi
2021-09-29 21:50 ` [PATCH v4 2/4] gdb: make string-like set show commands use std::string variable Lancelot SIX
2021-09-29 21:50 ` [PATCH v4 3/4] gdb: Have setter and getter callbacks for settings Lancelot SIX
2021-09-30 12:42   ` Simon Marchi
2021-10-05 19:10   ` Simon Marchi
2021-10-05 20:27     ` Lancelot SIX
2021-10-05 20:39       ` Simon Marchi
2021-10-05 22:21         ` Lancelot SIX
2021-09-29 21:50 ` [PATCH v4 4/4] gdb: Setting setter return a bool to tell if the value changed Lancelot SIX
2021-09-30 12:43   ` Simon Marchi
2021-09-30 12:44 ` [PATCH v4 0/4] Refactor cmd_list_element.var Simon Marchi
2021-10-03 19:22   ` Lancelot SIX

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=20210930231558.3ka4vglabsdq4ern@ubuntu.lan \
    --to=lsix@lancelotsix.com \
    --cc=gdb-patches@sourceware.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).