Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Denis PILAT <denis.pilat@st.com>
Cc: Daniel Jacobowitz <drow@false.org>,
		gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC] varobj deletion after the binary has changed
Date: Thu, 25 Jan 2007 22:31:00 -0000	[thread overview]
Message-ID: <17849.12231.246980.478169@kahikatea.snap.net.nz> (raw)
In-Reply-To: <45B8E8A8.9040904@st.com>


To avoid confusion these are my opinions; I don't have authority to approve
the patch.

 > --- varobj.c	(revision 552)
 > +++ varobj.c	(working copy)
 > @@ -77,6 +77,10 @@ struct varobj_root
 >  
 >    /* Next root variable */
 >    struct varobj_root *next;
 > +
 > +  /* Flag that indicates validity: set to 0 when this varobj_root refers 
 > +     to symbols that do not exist anymore.  */
 > +  int is_valid;
 >  };

I would move the is_valid member before *next.

 >  /* Every variable in the system has a structure of this type defined
 > @@ -912,6 +916,9 @@ varobj_update (struct varobj **varp, str
 >      /* Not a root var */
 >      return -1;
 >  
 > +  if (!(*varp)->root->is_valid)
 > +    return -1;

This seems to make the variable object some kind of zombie.  Wouldn't it
be better to make GDB report something like:

^done,changelist=[{name="var1",in_scope="invalid",type_changed="false"}]

so then the frontend can choose to delete these variable objects?

 >...
 > +void 
 > +varobj_invalidate (void)
 > +{
 > +  struct varobj **all_rootvarobj;
 > +  struct varobj **varp;
 > +
 > +  if (varobj_list (&all_rootvarobj) > 0)
 > +  {
 > +    varp = all_rootvarobj;
 > +    while (*varp != NULL)
 > +      {
 > +        /* global var must be re-evaluated.  */     
 > +        if ((*varp)->root->valid_block == NULL)
 > +        {
 > +          struct varobj *tmp_var;
 > +
 > +          /* try to create a varobj with same expression. if success we replace
 > +             the old varobj, othewize we invalidate it.  */      

              /* Try to create a varobj with same expression.  If we succeed replace
                 the old varobj, otherwise invalidate it.  */      



 > +          tmp_var = varobj_create (NULL, (*varp)->name, (CORE_ADDR) 0, USE_CURRENT_FRAME);
 > +          if (tmp_var != NULL) 
 > +            { 
 > +	      tmp_var->obj_name =
 > +		savestring ((*varp)->obj_name, strlen ((*varp)->obj_name));

Is xstrdup just a simpler version of savestring? i.e.
   
              tmp_var->obj_name = xstrdup (*varp)->obj_name);


 > +              varobj_delete (*varp, NULL, 0);
 > +              install_variable (tmp_var);
 > +            }
 > +          else
 > +              (*varp)->root->is_valid = 0;
 > +        }
 > +        else /* locals must be invalidated.  */
 > +          (*varp)->root->is_valid = 0;
 > +
 > +        varp++;
 > +      }
 > +    xfree (all_rootvarobj);
 > +  }
 > +  return;
 > +}
 >...

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


  reply	other threads:[~2007-01-25 22:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-23 12:32 Denis PILAT
2007-01-23 12:45 ` Daniel Jacobowitz
2007-01-23 12:52   ` Vladimir Prus
2007-01-23 14:49     ` Denis PILAT
2007-01-24 21:49       ` Nick Roberts
2007-01-24 22:07         ` Daniel Jacobowitz
2007-01-24 22:08         ` Frédéric Riss
2007-01-24 22:18           ` Nick Roberts
2007-01-24 22:52             ` Frédéric Riss
2007-01-24 23:14               ` Nick Roberts
2007-01-25  2:41             ` Daniel Jacobowitz
2007-01-25 20:50               ` Nick Roberts
2007-01-26  7:25                 ` Denis PILAT
2007-01-23 17:20   ` Denis PILAT
2007-01-25 17:28     ` Denis PILAT
2007-01-25 22:31       ` Nick Roberts [this message]
2007-01-25 23:27         ` Daniel Jacobowitz
2007-01-29 12:39           ` Denis PILAT
2007-01-29 22:12             ` Nick Roberts
2007-01-30  8:49               ` Denis PILAT
2007-01-31 19:07               ` Denis PILAT
2007-01-31 21:29                 ` Nick Roberts
2007-02-01  9:49                   ` Denis PILAT
2007-02-08 16:41                     ` Daniel Jacobowitz
2007-02-08 19:33                       ` Nick Roberts
2007-02-08 19:55                         ` Daniel Jacobowitz
2007-02-09 15:43                         ` Eli Zaretskii
2007-02-12 21:10                           ` Denis PILAT
2007-02-13  0:11                             ` Nick Roberts
2007-02-13  8:26                               ` Denis PILAT
2007-02-20 16:06                             ` Andreas Schwab
2007-02-20 16:17                               ` Denis PILAT

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=17849.12231.246980.478169@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=denis.pilat@st.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /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