Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Vladimir Prus <ghost@cs.msu.su>
Cc: Daniel Jacobowitz <drow@false.org>, 	gdb-patches@sources.redhat.com
Subject: Re: RFC: MI - Detecting change of string contents with variable objects
Date: Fri, 05 Jan 2007 01:09:00 -0000	[thread overview]
Message-ID: <17821.42314.506114.619107@kahikatea.snap.net.nz> (raw)
In-Reply-To: <200701050004.30631.ghost@cs.msu.su>

 > > +   /* Last print value */
 > 
 > Dot and two spaces ;-)

OK 

 >...
 > > + static char *value_get_print_value (struct value *value,
 > > +                                   enum varobj_display_formats format);
 > > + 
 > 
 > I don't see a comment to this function either here or at the definition
 > point.

Too many comments get in the way of the code and I think the name is fairly
self explanatory.  Most of the simple functions don't have a comment and AFAIK
a comment for them is not a GNU or GDB coding standard.

 > >   static int type_changeable (struct varobj *var);
 > >   
 > >   /* C implementation */
 > > *************** install_new_value (struct varobj *var, s
 > > *** 978,1003 ****
 > >             changed = 1;
 > >           else
 > >             {
 > >               gdb_assert (!value_lazy (var->value));
 > > -             gdb_assert (!value_lazy (value));
 > 
 > Did you remove this because it failed? If so, I'd like to understand why.
 > I think this assert is needed -- if the value is lazy, then even if
 > printing code will fetch the value, you'll be comparing current value with
 > current value. That's a definite bug, so must be asserted.

I removed it accidentally.  I've put it back.

 > >               
 > > !             if (!value_contents_equal (var->value, value))
 > > !               changed = 1;
 > >             }
 > >         }
 > >       }
 > > !     
 > >     /* We must always keep the new value, since children depend on it.  */
 > >     if (var->value != NULL)
 > >       value_free (var->value);
 > >     var->value = value;
 > >     var->updated = 0;
 > > !   
 > >     gdb_assert (!var->value || value_type (var->value));
 > 
 > Is that a formatting change above?

I've just removed unnecessay spaces.  The real change is replacing
value_contents_equal (but what's with all the underscores!).

 > > !                 if (strcmp (var->print_value, print_value))
 > 
 > Can you use 
 > 
 >         strcmp (var->print_value, print_value) != 0

Is that more legible?  I sometimes see "if (fi != NULL)" but "if (fi)"
seems clearer.  Maybe it comes from programming in Lisp for Emacs.

 > for legibility?
 > 
 > > !                   {
 > > !                     xfree (var->print_value);
 > > !                     var->print_value = print_value;
 > > !                     changed = 1;
 > > !                   }
 > 
 > So, if values differ you xfree the old one and assign the new one. If the
 > values are the same -- where is 'print_value' freed?

It's not; it's a legacy of earlier code.  I'll change it.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


  reply	other threads:[~2007-01-05  1:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-18  2:42 Nick Roberts
2006-12-18  7:01 ` Vladimir Prus
2006-12-18  8:15   ` Nick Roberts
2006-12-18  8:36     ` Vladimir Prus
2006-12-18 13:38       ` Daniel Jacobowitz
2006-12-18 21:57         ` Nick Roberts
2006-12-21 15:25           ` Vladimir Prus
2006-12-21 22:28             ` Nick Roberts
2006-12-22  6:16               ` Vladimir Prus
2006-12-22  7:16                 ` Nick Roberts
2006-12-22  7:23                   ` Vladimir Prus
2007-01-03 22:46           ` Daniel Jacobowitz
2007-01-04  4:13             ` Nick Roberts
2007-01-04  4:20               ` Daniel Jacobowitz
2007-01-04  6:10                 ` Nick Roberts
2007-01-04 19:40                   ` Daniel Jacobowitz
2007-01-04 20:35                     ` Nick Roberts
2007-01-04 20:50                       ` Daniel Jacobowitz
2007-01-04 21:00                         ` Vladimir Prus
2007-01-05  4:46                           ` Nick Roberts
2007-01-05 14:49                             ` Daniel Jacobowitz
2007-01-05 21:54                               ` Nick Roberts
2007-01-06  7:07                                 ` Vladimir Prus
2007-01-08 15:51                                 ` Daniel Jacobowitz
2007-01-08 21:30                                   ` Nick Roberts
2007-01-08 21:41                                     ` Daniel Jacobowitz
2007-01-04 20:57                       ` Vladimir Prus
2007-01-05  2:26                         ` Nick Roberts
2007-01-04 21:05                   ` Vladimir Prus
2007-01-05  1:09                     ` Nick Roberts [this message]
2007-01-05 14:44                       ` Daniel Jacobowitz
2007-01-05 14:49                         ` Vladimir Prus
2007-01-05 16:04                       ` Jim Blandy

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=17821.42314.506114.619107@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=ghost@cs.msu.su \
    /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