/* varobj support for C and C++.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
if (value && *value)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
*value = value_ind (*value);
}
- if (except.reason < 0)
- *value = NULL;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ *value = NULL;
+ }
+ END_CATCH
}
*type = target_type;
if (was_ptr)
&& TYPE_NAME (type) == NULL
&& TYPE_TAG_NAME (type) == NULL)
{
- struct varobj *parent = var->parent;
+ const struct varobj *parent = var->parent;
while (parent != NULL && CPLUS_FAKE_CHILD (parent))
parent = parent->parent;
value_struct_element_index (struct value *value, int type_index)
{
struct value *result = NULL;
- volatile struct gdb_exception e;
struct type *type = value_type (value);
type = check_typedef (type);
gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION);
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ TRY
{
if (field_is_static (&TYPE_FIELD (type, type_index)))
result = value_static_field (type, type_index);
else
result = value_primitive_field (value, 0, type_index, type);
}
- if (e.reason < 0)
+ CATCH (e, RETURN_MASK_ERROR)
{
return NULL;
}
- else
- {
- return result;
- }
+ END_CATCH
+
+ return result;
}
/* Obtain the information about child INDEX of the variable
to NULL. */
static void
-c_describe_child (struct varobj *parent, int index,
+c_describe_child (const struct varobj *parent, int index,
char **cname, struct value **cvalue, struct type **ctype,
char **cfull_expression)
{
struct type *type = varobj_get_value_type (parent);
char *parent_expression = NULL;
int was_ptr;
- volatile struct gdb_exception except;
if (cname)
*cname = NULL;
{
int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
*cvalue = value_subscript (value, real_index);
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
if (ctype)
if (cfull_expression)
{
- char *join = was_ptr ? "->" : ".";
+ const char *join = was_ptr ? "->" : ".";
*cfull_expression = xstrprintf ("(%s)%s%s", parent_expression,
join, field_name);
if (cvalue && value)
{
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
*cvalue = value_ind (value);
}
- if (except.reason < 0)
- *cvalue = NULL;
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ *cvalue = NULL;
+ }
+ END_CATCH
}
/* Don't use get_target_type because it calls
}
static char *
-c_name_of_child (struct varobj *parent, int index)
+c_name_of_child (const struct varobj *parent, int index)
{
char *name;
}
static struct value *
-c_value_of_child (struct varobj *parent, int index)
+c_value_of_child (const struct varobj *parent, int index)
{
struct value *value = NULL;
}
static struct type *
-c_type_of_child (struct varobj *parent, int index)
+c_type_of_child (const struct varobj *parent, int index)
{
struct type *type = NULL;
/* It is necessary to access a real type (via RTTI). */
if (opts.objectprint)
{
- struct varobj *parent = var->parent;
+ const struct varobj *parent = var->parent;
value = parent->value;
lookup_actual_type = (TYPE_CODE (parent->type) == TYPE_CODE_REF
}
static void
-cplus_describe_child (struct varobj *parent, int index,
+cplus_describe_child (const struct varobj *parent, int index,
char **cname, struct value **cvalue, struct type **ctype,
char **cfull_expression)
{
int was_ptr;
int lookup_actual_type = 0;
char *parent_expression = NULL;
- struct varobj *var;
+ const struct varobj *var;
struct value_print_options opts;
if (cname)
if (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION)
{
- char *join = was_ptr ? "->" : ".";
+ const char *join = was_ptr ? "->" : ".";
if (CPLUS_FAKE_CHILD (parent))
{
if (cfull_expression)
{
- char *ptr = was_ptr ? "*" : "";
+ const char *ptr = was_ptr ? "*" : "";
/* Cast the parent to the base' type. Note that in gdb,
expression like
}
static char *
-cplus_name_of_child (struct varobj *parent, int index)
+cplus_name_of_child (const struct varobj *parent, int index)
{
char *name = NULL;
}
static struct value *
-cplus_value_of_child (struct varobj *parent, int index)
+cplus_value_of_child (const struct varobj *parent, int index)
{
struct value *value = NULL;
}
static struct type *
-cplus_type_of_child (struct varobj *parent, int index)
+cplus_type_of_child (const struct varobj *parent, int index)
{
struct type *type = NULL;