static int is_root_p (struct varobj *var);
-#if HAVE_PYTHON
-
static struct varobj *varobj_add_child (struct varobj *var,
struct varobj_item *item);
-#endif /* HAVE_PYTHON */
-
/* Private data */
/* Mappings of varobj_display_formats enums to gdb's format codes. */
{
struct frame_info *fi;
struct frame_id old_id = null_frame_id;
- struct block *block;
+ const struct block *block;
const char *p;
struct value *value = NULL;
volatile struct gdb_exception except;
}
}
-#if HAVE_PYTHON
-
/* A helper for update_dynamic_varobj_children that installs a new
child when needed. */
}
}
+#if HAVE_PYTHON
+
static int
dynamic_varobj_has_child_method (struct varobj *var)
{
do_cleanups (back_to);
return result;
}
+#endif
/* A factory for creating dynamic varobj's iterators. Returns an
iterator object suitable for iterating over VAR's children. */
static struct varobj_iter *
varobj_get_iterator (struct varobj *var)
{
+#if HAVE_PYTHON
if (var->dynamic->pretty_printer)
return py_varobj_get_iterator (var, var->dynamic->pretty_printer);
+#endif
gdb_assert_not_reached (_("\
requested an iterator from a non-dynamic varobj"));
var->saved_item = NULL;
}
}
-#endif
static int
update_dynamic_varobj_children (struct varobj *var,
int from,
int to)
{
-#if HAVE_PYTHON
int i;
*cchanged = 0;
var->num_children = VEC_length (varobj_p, var->children);
return 1;
-#else
- gdb_assert_not_reached ("should never be called if Python is not enabled");
-#endif
}
int
{
if (var->num_children == -1)
{
- if (var->dynamic->pretty_printer != NULL)
+ if (varobj_is_dynamic_p (var))
{
int dummy;
var->dynamic->children_requested = 1;
- if (var->dynamic->pretty_printer != NULL)
+ if (varobj_is_dynamic_p (var))
{
/* This, in theory, can result in the number of children changing without
frontend noticing. But well, calling -var-list-children on the same
return var->children;
}
-#if HAVE_PYTHON
-
static struct varobj *
varobj_add_child (struct varobj *var, struct varobj_item *item)
{
return v;
}
-#endif /* HAVE_PYTHON */
-
/* Obtain the type of an object Variable as a string similar to the one gdb
prints on the console. */
static int
is_path_expr_parent (struct varobj *var)
{
- struct type *type;
-
- /* "Fake" children are not path_expr parents. */
- if (CPLUS_FAKE_CHILD (var))
- return 0;
+ gdb_assert (var->root->lang_ops->is_path_expr_parent != NULL);
+ return var->root->lang_ops->is_path_expr_parent (var);
+}
- type = varobj_get_value_type (var);
+/* Is VAR a path expression parent, i.e., can it be used to construct
+ a valid path expression? By default we assume any VAR can be a path
+ parent. */
- /* Anonymous unions and structs are also not path_expr parents. */
- return !((TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
- && TYPE_NAME (type) == NULL);
+int
+varobj_default_is_path_expr_parent (struct varobj *var)
+{
+ return 1;
}
/* Return the path expression parent for VAR. */
return attributes;
}
+/* Return true if VAR is a dynamic varobj. */
+
int
-varobj_pretty_printed_p (struct varobj *var)
+varobj_is_dynamic_p (struct varobj *var)
{
return var->dynamic->pretty_printer != NULL;
}
}
}
- /* We probably should not get children of a varobj that has a
- pretty-printer, but for which -var-list-children was never
- invoked. */
- if (v->dynamic->pretty_printer != NULL)
+ /* We probably should not get children of a dynamic varobj, but
+ for which -var-list-children was never invoked. */
+ if (varobj_is_dynamic_p (v))
{
VEC (varobj_p) *changed = 0, *type_changed = 0, *unchanged = 0;
VEC (varobj_p) *new = 0;