Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] varobj.c
@ 2007-02-14 23:06 Nick Roberts
  2007-02-27 17:04 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Roberts @ 2007-02-14 23:06 UTC (permalink / raw)
  To: gdb-patches


Following Denis' patch, this patch makes GDB throw a user error if a non
root variable is used for -var-update.  Currently GDB does:

(gdb)
-var-update var1.1
^done,changelist=[{name="var1.1",in_scope="false"}]
(gdb)

even though the expression that var1.1 represents may be inscope and have
changed value.

with this change:

(gdb)
-var-update var1.1
&"Only root variables can be updated\n"
^error,msg="Only root variables can be updated"
(gdb)

It also uses an assert if changelist is NULL.  I'm not sure how changelist
could be NULL, but if it is GDB has really lost the plot.

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


2007-02-15  Nick Roberts  <nickrob@snap.net.nz>

	* varobj.c (varobj_update): Remove unused local.  Use gdb_assert
	to check changelist is non-NULL.  Call error if the frontend tries
	to update a non-root variable.

	* varobj.h (enum varobj_update_error): Delete WRONG_PARAM value.


*** varobj.h	13 Feb 2007 21:31:43 +1300	1.8
--- varobj.h	15 Feb 2007 11:38:47 +1300	
*************** enum varobj_update_error
*** 45,51 ****
      NOT_IN_SCOPE = -1,          /* varobj not in scope, can not be updated.  */
      TYPE_CHANGED = -2,          /* varobj type has changed.  */
      INVALID = -3,               /* varobj is not valid anymore.  */
-     WRONG_PARAM = -4            /* function is called with wrong arguments.  */
    };
  
  /* String representations of gdb's format codes (defined in varobj.c) */
--- 45,50 ----
*** varobj.c	13 Feb 2007 21:31:43 +1300	1.84
--- varobj.c	15 Feb 2007 11:46:07 +1300	
*************** int
*** 1037,1043 ****
  varobj_update (struct varobj **varp, struct varobj ***changelist)
  {
    int changed = 0;
-   int error = 0;
    int type_changed;
    int i;
    int vleft;
--- 1037,1042 ----
*************** varobj_update (struct varobj **varp, str
*** 1051,1063 ****
    struct frame_info *fi;
  
    /* sanity check: have we been passed a pointer?  */
!   if (changelist == NULL)
!     return WRONG_PARAM;
  
-   /*  Only root variables can be updated...  */
    if (!is_root_p (*varp))
!     /* Not a root var.  */
!     return WRONG_PARAM;
  
    if (!(*varp)->root->is_valid)
      return INVALID;
--- 1050,1059 ----
    struct frame_info *fi;
  
    /* sanity check: have we been passed a pointer?  */
!   gdb_assert (changelist);
  
    if (!is_root_p (*varp))
!     error (_("Only root variables can be updated"));
  
    if (!(*varp)->root->is_valid)
      return INVALID;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] varobj.c
  2007-02-14 23:06 [PATCH] varobj.c Nick Roberts
@ 2007-02-27 17:04 ` Daniel Jacobowitz
  2007-02-28  6:36   ` Vladimir Prus
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-02-27 17:04 UTC (permalink / raw)
  To: Nick Roberts, Vladimir Prus; +Cc: gdb-patches

On Thu, Feb 15, 2007 at 12:05:47PM +1300, Nick Roberts wrote:
> 
> Following Denis' patch, this patch makes GDB throw a user error if a non
> root variable is used for -var-update.  Currently GDB does:
> 
> (gdb)
> -var-update var1.1
> ^done,changelist=[{name="var1.1",in_scope="false"}]
> (gdb)
> 
> even though the expression that var1.1 represents may be inscope and have
> changed value.

Vladimir, didn't you have some in-progress patch that actually wanted
to update root varobjs?  Anyway, if so, we can change it back later.

> 2007-02-15  Nick Roberts  <nickrob@snap.net.nz>
> 
> 	* varobj.c (varobj_update): Remove unused local.  Use gdb_assert
> 	to check changelist is non-NULL.  Call error if the frontend tries
> 	to update a non-root variable.
> 
> 	* varobj.h (enum varobj_update_error): Delete WRONG_PARAM value.

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] varobj.c
  2007-02-27 17:04 ` Daniel Jacobowitz
@ 2007-02-28  6:36   ` Vladimir Prus
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Prus @ 2007-02-28  6:36 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Nick Roberts, gdb-patches

On Tuesday 27 February 2007 20:04, Daniel Jacobowitz wrote:
> On Thu, Feb 15, 2007 at 12:05:47PM +1300, Nick Roberts wrote:
> > 
> > Following Denis' patch, this patch makes GDB throw a user error if a non
> > root variable is used for -var-update.  Currently GDB does:
> > 
> > (gdb)
> > -var-update var1.1
> > ^done,changelist=[{name="var1.1",in_scope="false"}]
> > (gdb)
> > 
> > even though the expression that var1.1 represents may be inscope and have
> > changed value.
> 
> Vladimir, didn't you have some in-progress patch that actually wanted
> to update root varobjs?  Anyway, if so, we can change it back later.

You mean, update *non-root* varobjs? Yes, frozen varobjs patches makes
that possible. I believe the last version of said patch was posted in:

	http://article.gmane.org/gmane.comp.gdb.patches/31838

and nobody has reviewed it yet.


- Volodya


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-28  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14 23:06 [PATCH] varobj.c Nick Roberts
2007-02-27 17:04 ` Daniel Jacobowitz
2007-02-28  6:36   ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox