aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-varobj.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-04-03 18:15:13 -0600
committerTom Tromey <tom@tromey.com>2018-04-06 15:44:48 -0600
commitb4d61099ba840824fd0aac9800403f6278476347 (patch)
treee2424dd947930be814dfb299fd671de6bd16037e /gdb/c-varobj.c
parent9b5587295bbc57e5e0453b659e24d7c2b504b894 (diff)
downloadgdb-b4d61099ba840824fd0aac9800403f6278476347.zip
gdb-b4d61099ba840824fd0aac9800403f6278476347.tar.gz
gdb-b4d61099ba840824fd0aac9800403f6278476347.tar.bz2
Change varobj to use value_ref_ptr
This changes varobj to use value_ref_ptr, allowing the removal of some manual reference count management. gdb/ChangeLog 2018-04-06 Tom Tromey <tom@tromey.com> * varobj.h (struct varobj) <value>: Now a value_ref_ptr. * varobj.c (varobj_set_display_format, varobj_set_value) (install_default_visualizer, construct_visualizer) (install_new_value, ~varobj, varobj_get_value_type) (my_value_of_variable, varobj_editable_p): Update. * c-varobj.c (c_describe_child, c_value_of_variable) (cplus_number_of_children, cplus_describe_child): Update. * ada-varobj.c (ada_number_of_children, ada_name_of_child) (ada_path_expr_of_child, ada_value_of_child, ada_type_of_child) (ada_value_of_variable, ada_value_is_changeable_p): Update.
Diffstat (limited to 'gdb/c-varobj.c')
-rw-r--r--gdb/c-varobj.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index babda29..03656c0 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -286,7 +286,7 @@ c_describe_child (const struct varobj *parent, int index,
std::string *cname, struct value **cvalue,
struct type **ctype, std::string *cfull_expression)
{
- struct value *value = parent->value;
+ struct value *value = parent->value.get ();
struct type *type = varobj_get_value_type (parent);
std::string parent_expression;
int was_ptr;
@@ -513,21 +513,22 @@ c_value_of_variable (const struct varobj *var,
}
else
{
- if (var->not_fetched && value_lazy (var->value))
+ if (var->not_fetched && value_lazy (var->value.get ()))
/* Frozen variable and no value yet. We don't
implicitly fetch the value. MI response will
use empty string for the value, which is OK. */
return std::string ();
gdb_assert (varobj_value_is_changeable_p (var));
- gdb_assert (!value_lazy (var->value));
+ gdb_assert (!value_lazy (var->value.get ()));
/* If the specified format is the current one,
we can reuse print_value. */
if (format == var->format)
return var->print_value;
else
- return varobj_value_get_print_value (var->value, format, var);
+ return varobj_value_get_print_value (var->value.get (), format,
+ var);
}
}
}
@@ -579,7 +580,7 @@ cplus_number_of_children (const struct varobj *var)
/* It is necessary to access a real type (via RTTI). */
if (opts.objectprint)
{
- value = var->value;
+ value = var->value.get ();
lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
|| TYPE_CODE (var->type) == TYPE_CODE_PTR);
}
@@ -616,7 +617,7 @@ cplus_number_of_children (const struct varobj *var)
{
const struct varobj *parent = var->parent;
- value = parent->value;
+ value = parent->value.get ();
lookup_actual_type = (TYPE_IS_REFERENCE (parent->type)
|| TYPE_CODE (parent->type) == TYPE_CODE_PTR);
}
@@ -724,7 +725,7 @@ cplus_describe_child (const struct varobj *parent, int index,
if (opts.objectprint)
lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
|| TYPE_CODE (var->type) == TYPE_CODE_PTR);
- value = var->value;
+ value = var->value.get ();
type = varobj_get_value_type (var);
if (cfull_expression)
parent_expression