public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA 02/12] Change breakpoints to use value_ref_ptr
Date: Fri, 06 Apr 2018 19:31:00 -0000	[thread overview]
Message-ID: <b317f84d-4a85-f0c5-a96c-cfde9ca7092c@redhat.com> (raw)
In-Reply-To: <20180405211507.6103-3-tom@tromey.com>

On 04/05/2018 10:14 PM, Tom Tromey wrote:


>  4 files changed, 48 insertions(+), 54 deletions(-)
> 
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index 68292626d3..67ba5a6b31 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -1740,8 +1740,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
>  	 no longer relevant.  We don't want to report a watchpoint hit
>  	 to the user when the old value and the new value may actually
>  	 be completely different objects.  */
> -      value_decref (b->val);
> -      b->val = NULL;
> +      b->val.reset (nullptr);

Just OOC, wouldn't the old "b->val = NULL;" work the same as the
reset call?

>        b->val_valid = 0;

> @@ -14533,7 +14516,7 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior,
>        {
>  	struct watchpoint *wp = (struct watchpoint *) bp;
>  
> -	if (wp->val_valid && wp->val)
> +	if (wp->val_valid && wp->val.get ())

Nit, about this get(): I wonder whether we should add an
  explicit operator bool() 
implementation to gdb_ref_ptr to avoid it.

I guess we should instead write the explicit:

  if (wp->val_valid && wp->val != nullptr)

making that moot.

Thanks,
Pedro Alves

  reply	other threads:[~2018-04-06 19:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 21:16 [RFA 00/12] (somewhat) clean up struct value ownership Tom Tromey
2018-04-05 21:16 ` [RFA 08/12] Remove value::next and value::released Tom Tromey
2018-04-06 19:32   ` Pedro Alves
2018-04-06 21:40     ` Tom Tromey
2018-04-05 21:16 ` [RFA 04/12] Change varobj to use value_ref_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 10/12] Change value::parent to a value_ref_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 06/12] Remove free_all_values Tom Tromey
2018-04-05 21:16 ` [RFA 01/12] Introduce a gdb_ref_ptr specialization for struct value Tom Tromey
2018-04-06 19:29   ` Pedro Alves
2018-04-05 21:16 ` [RFA 05/12] Change value history to use value_ref_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 12/12] Change value::contents to be a unique_xmalloc_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 02/12] Change breakpoints to use value_ref_ptr Tom Tromey
2018-04-06 19:31   ` Pedro Alves [this message]
2018-04-06 21:31     ` Tom Tromey
2018-04-05 21:16 ` [RFA 07/12] Remove free_value_chain Tom Tromey
2018-04-05 21:16 ` [RFA 11/12] Remove range_s VEC Tom Tromey
2018-04-05 21:16 ` [RFA 03/12] Change last_examine_value to value_ref_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 09/12] Use new and delete for values Tom Tromey
2018-04-06 19:33 ` [RFA 00/12] (somewhat) clean up struct value ownership Pedro Alves
2018-04-06 21:20   ` Tom Tromey
2018-04-06 21:44   ` Tom Tromey
2018-04-08 21:32   ` Tom Tromey

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=b317f84d-4a85-f0c5-a96c-cfde9ca7092c@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).