2000-12-03 Stephane Carrez <Stephane.Carrez@worldnet.fr>
[deliverable/binutils-gdb.git] / gdb / varobj.c
index 5cc6e88d1679ecdf89999cb25b6f4d9ea5ad9c91..6528bcb89f225cb6ff29c3f7295bc116ba72b30e 100644 (file)
@@ -411,7 +411,8 @@ varobj_create (char *objname,
               enum varobj_type type)
 {
   struct varobj *var;
-  struct frame_info *fi, *old_fi;
+  struct frame_info *fi;
+  struct frame_info *old_fi = NULL;
   struct block *block;
   struct cleanup *old_chain;
 
@@ -781,8 +782,9 @@ varobj_set_value (struct varobj *var, char *expression)
       value_ptr temp;
 
       input_radix = 10;                /* ALWAYS reset to decimal temporarily */
-      /* FIXME: Callee may longjump */
-      exp = parse_exp_1 (&s, 0, 0);
+      if (!gdb_parse_exp_1 (&s, 0, 0, &exp))
+       /* We cannot proceed without a well-formed expression. */
+       return 0;
       if (!gdb_evaluate_expression (exp, &value))
        {
          /* We cannot proceed without a valid expression. */
@@ -817,7 +819,8 @@ varobj_set_value (struct varobj *var, char *expression)
        }
 
       VALUE_ADDRESS (temp) += offset;
-      val = value_assign (temp, value);
+      if (!gdb_value_assign (temp, value, &val))
+       return 0;
       VALUE_ADDRESS (val) -= offset;
       value_free (var->value);
       release_value (val);
@@ -881,7 +884,7 @@ varobj_update (struct varobj *var, struct varobj ***changelist)
   int error2;
   struct varobj *v;
   struct varobj **cv;
-  struct varobj **templist;
+  struct varobj **templist = NULL;
   value_ptr new;
   struct vstack *stack = NULL;
   struct vstack *result = NULL;
@@ -916,21 +919,24 @@ varobj_update (struct varobj *var, struct varobj ***changelist)
   /* Initialize a stack for temporary results */
   vpush (&result, NULL);
 
-  if (type_changed || !my_value_equal (var->value, new, &error2))
+  /* If this is a "use_selected_frame" varobj, and its type has changed,
+     them note that it's changed. */
+  if (type_changed)
     {
-      /* Note that it's changed   There a couple of exceptions here,
-         though. We don't want some types to be reported as 
-        "changed". The exception to this is if this is a 
-        "use_selected_frame" varobj, and its type has changed. */
-      if (type_changed || type_changeable (var))
-       {
-         vpush (&result, var);
-         changed++;
-       }
+      vpush (&result, var);
+      changed++;
+    }
+  /* If values are not equal, note that it's changed.
+     There a couple of exceptions here, though.
+     We don't want some types to be reported as "changed". */
+  else if (type_changeable (var) && !my_value_equal (var->value, new, &error2))
+    {
+      vpush (&result, var);
+      changed++;
+      /* error2 replaces var->error since this new value
+         WILL replace the old one. */
+      var->error = error2;
     }
-  /* error2 replaces var->error since this new value
-     WILL replace the old one. */
-  var->error = error2;
 
   /* We must always keep around the new value for this root
      variable expression, or we lose the updated children! */
@@ -1211,9 +1217,7 @@ uninstall_variable (struct varobj *var)
 /* Does a child with the name NAME exist in VAR? If so, return its data.
    If not, return NULL. */
 static struct varobj *
-child_exists (var, name)
-     struct varobj *var;       /* Parent */
-     char *name;               /* name of child */
+child_exists (struct varobj *var, char *name)
 {
   struct varobj_child *vc;
 
@@ -1722,6 +1726,7 @@ type_changeable (struct varobj *var)
     {
       case TYPE_CODE_STRUCT:
       case TYPE_CODE_UNION:
+      case TYPE_CODE_ARRAY:
        r = 0;
        break;
 
@@ -2150,9 +2155,7 @@ cplus_number_of_children (struct varobj *var)
    That means we need to descend into all baseclasses and find out
    how many are there, too. */
 static void
-cplus_class_num_children (type, children)
-     struct type *type;
-     int children[3];
+cplus_class_num_children (struct type *type, int children[3])
 {
   int i;
 
This page took 0.024091 seconds and 4 git commands to generate.