Add bootstrap-asan.mk
[deliverable/binutils-gdb.git] / gdb / varobj.c
index 308649972108ad8a954abf511d3b7737c8b66ba3..130f438f2d7a90f8e1d2eb66b888faa927c4d003 100644 (file)
@@ -49,7 +49,7 @@ typedef int PyObject;
 
 /* Non-zero if we want to see trace of varobj level stuff.  */
 
-int varobjdebug = 0;
+unsigned int varobjdebug = 0;
 static void
 show_varobjdebug (struct ui_file *file, int from_tty,
                  struct cmd_list_element *c, const char *value)
@@ -84,7 +84,7 @@ struct varobj_root
   struct expression *exp;
 
   /* Block for which this expression is valid.  */
-  struct block *valid_block;
+  const struct block *valid_block;
 
   /* The frame for this expression.  This field is set iff valid_block is
      not NULL.  */
@@ -624,6 +624,7 @@ varobj_create (char *objname,
       enum varobj_languages lang;
       struct value *value = NULL;
       volatile struct gdb_exception except;
+      CORE_ADDR pc;
 
       /* Parse and evaluate the expression, filling in as much of the
          variable's data as possible.  */
@@ -650,9 +651,13 @@ varobj_create (char *objname,
       if (type == USE_SELECTED_FRAME)
        var->root->floating = 1;
 
+      pc = 0;
       block = NULL;
       if (fi != NULL)
-       block = get_frame_block (fi, 0);
+       {
+         block = get_frame_block (fi, 0);
+         pc = get_frame_pc (fi);
+       }
 
       p = expression;
       innermost_block = NULL;
@@ -660,7 +665,7 @@ varobj_create (char *objname,
          return a sensible error.  */
       TRY_CATCH (except, RETURN_MASK_ERROR)
        {
-         var->root->exp = parse_exp_1 (&p, block, 0);
+         var->root->exp = parse_exp_1 (&p, pc, block, 0);
        }
 
       if (except.reason < 0)
@@ -670,7 +675,9 @@ varobj_create (char *objname,
        }
 
       /* Don't allow variables to be created for types.  */
-      if (var->root->exp->elts[0].opcode == OP_TYPE)
+      if (var->root->exp->elts[0].opcode == OP_TYPE
+         || var->root->exp->elts[0].opcode == OP_TYPEOF
+         || var->root->exp->elts[0].opcode == OP_DECLTYPE)
        {
          do_cleanups (old_chain);
          fprintf_unfiltered (gdb_stderr, "Attempt to use a type name"
@@ -1107,9 +1114,6 @@ update_dynamic_varobj_children (struct varobj *var,
 
       make_cleanup_py_decref (children);
 
-      if (!PyIter_Check (children))
-       error (_("Returned value is not iterable"));
-
       Py_XDECREF (var->child_iter);
       var->child_iter = PyObject_GetIter (children);
       if (!var->child_iter)
@@ -1471,7 +1475,7 @@ varobj_set_value (struct varobj *var, char *expression)
   gdb_assert (varobj_editable_p (var));
 
   input_radix = 10;            /* ALWAYS reset to decimal temporarily.  */
-  exp = parse_exp_1 (&s, 0, 0);
+  exp = parse_exp_1 (&s, 0, 0, 0);
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
       value = evaluate_expression (exp);
@@ -4169,28 +4173,27 @@ _initialize_varobj (void)
   varobj_table = xmalloc (sizeof_table);
   memset (varobj_table, 0, sizeof_table);
 
-  add_setshow_zinteger_cmd ("debugvarobj", class_maintenance,
-                           &varobjdebug,
-                           _("Set varobj debugging."),
-                           _("Show varobj debugging."),
-                           _("When non-zero, varobj debugging is enabled."),
-                           NULL, show_varobjdebug,
-                           &setlist, &showlist);
+  add_setshow_zuinteger_cmd ("debugvarobj", class_maintenance,
+                            &varobjdebug,
+                            _("Set varobj debugging."),
+                            _("Show varobj debugging."),
+                            _("When non-zero, varobj debugging is enabled."),
+                            NULL, show_varobjdebug,
+                            &setlist, &showlist);
 }
 
 /* Invalidate varobj VAR if it is tied to locals and re-create it if it is
-   defined on globals.  It is a helper for varobj_invalidate.  */
+   defined on globals.  It is a helper for varobj_invalidate.
+
+   This function is called after changing the symbol file, in this case the
+   pointers to "struct type" stored by the varobj are no longer valid.  All
+   varobj must be either re-evaluated, or marked as invalid here.  */
 
 static void
 varobj_invalidate_iter (struct varobj *var, void *unused)
 {
-  /* Floating varobjs are reparsed on each stop, so we don't care if the
-     presently parsed expression refers to something that's gone.  */
-  if (var->root->floating)
-    return;
-
-  /* global var must be re-evaluated.  */     
-  if (var->root->valid_block == NULL)
+  /* global and floating var must be re-evaluated.  */
+  if (var->root->floating || var->root->valid_block == NULL)
     {
       struct varobj *tmp_var;
 
This page took 0.026745 seconds and 4 git commands to generate.