Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [MI] lvalues and variable_editable
@ 2007-06-26 11:46 Nick Roberts
  2007-07-03 16:16 ` Daniel Jacobowitz
  0 siblings, 1 reply; 20+ messages in thread
From: Nick Roberts @ 2007-06-26 11:46 UTC (permalink / raw)
  To: gdb-patches


I've been wondering what the difference is between varobj_value_is_changeable_p
and variable_editable.  Recent discussion on the gdb mailing list makes
me think that, in essence, a value is only changeable but not editable when
it's an lvalue -- but currently varobj.c doesn't capture this difference.

Here are two experimental patches:

1) varobj.c: Test if the value of variable object is an lvalue.  I think this
   can only occur for root values.

2) mi-cmd-var.c: Output a field with -var-create and -var-list-children
   when noneditable.

The testsuite only needs to change for 2).

It would seem sensible to define variable_editable using
varobj_value_is_changeable_p and I don't think language dependent versions
aren't needed.

WDYT?

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



*** varobj.c	14 Apr 2007 21:51:29 +1200	1.89
--- varobj.c	26 Jun 2007 23:12:52 +1200	
*************** c_type_of_child (struct varobj *parent, 
*** 2131,2136 ****
--- 2131,2151 ----
  static int
  c_variable_editable (struct varobj *var)
  {
+   struct expression *exp;
+   struct value *value;
+ 
+   if (is_root_p (var))
+     {
+       if (!gdb_evaluate_expression (var->root->exp, &value))
+ 	{
+ 	  /* We cannot proceed without a valid expression. */
+ 	  xfree (exp);
+ 	  return 0;
+ 	}
+       if (!VALUE_LVAL(value))
+ 	return 0;
+     }
+ 
    switch (TYPE_CODE (get_value_type (var)))
      {
      case TYPE_CODE_STRUCT:


*** mi-cmd-var.c	14 Jun 2007 10:12:15 +1200	1.33
--- mi-cmd-var.c	26 Jun 2007 21:32:26 +1200	
*************** print_varobj (struct varobj *var, enum p
*** 66,71 ****
--- 66,74 ----
        xfree (type);
      }
  
+   if (!(varobj_get_attributes (var) & 0x00000001))
+     ui_out_field_string (uiout, "attr", "noneditable");
+ 
    if (varobj_get_frozen (var))
      ui_out_field_int (uiout, "frozen", 1);
  }


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

end of thread, other threads:[~2007-07-11 13:09 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-26 11:46 [MI] lvalues and variable_editable Nick Roberts
2007-07-03 16:16 ` Daniel Jacobowitz
2007-07-04  3:04   ` Nick Roberts
2007-07-04  3:11     ` Nick Roberts
2007-07-04  3:14       ` Daniel Jacobowitz
2007-07-04  3:35         ` Nick Roberts
2007-07-04 15:57           ` Daniel Jacobowitz
2007-07-09  5:51           ` Nick Roberts
2007-07-09 12:05             ` Daniel Jacobowitz
2007-07-09 12:38               ` Nick Roberts
2007-07-10  1:45                 ` Daniel Jacobowitz
2007-07-09 12:46               ` Vladimir Prus
2007-07-09 13:13             ` Vladimir Prus
2007-07-10  0:49               ` Nick Roberts
2007-07-10 17:14                 ` Vladimir Prus
2007-07-11  1:26                   ` Nick Roberts
2007-07-11  6:46                     ` Vladimir Prus
2007-07-11  7:10                       ` Vladimir Prus
2007-07-11 11:57                       ` Nick Roberts
2007-07-11 13:09                         ` Vladimir Prus

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