+2017-03-20 Artemiy Volkov <artemiyv@acm.org>
+
+ PR gdb/14441
+ * doc/python.texi (Types in Python): Add TYPE_CODE_RVALUE_REF to
+ table of constants.
+ * python/lib/gdb/command/explore.py: Support exploring values
+ of rvalue reference types.
+ * python/lib/gdb/types.py: Implement get_basic_type() for
+ rvalue reference types.
+ * python/py-type.c (pyty_codes) <TYPE_CODE_RVALUE_REF>: New
+ constant.
+ * python/py-value.c (valpy_getitem): Add an rvalue reference
+ check.
+ (valpy_reference_value): Add new parameter "refcode".
+ (valpy_lvalue_reference_value, valpy_rvalue_reference_value):
+ New wrappers for valpy_reference_value().
+ * python/py-xmethods.c (gdbpy_get_xmethod_result_type)
+ (gdbpy_invoke_xmethod): Likewise.
+
2017-03-20 Artemiy Volkov <artemiyv@acm.org>
PR gdb/14441
gdb.TYPE_CODE_UNION : CompoundExplorer,
gdb.TYPE_CODE_PTR : PointerExplorer,
gdb.TYPE_CODE_REF : ReferenceExplorer,
+ gdb.TYPE_CODE_RVALUE_REF : ReferenceExplorer,
gdb.TYPE_CODE_TYPEDEF : TypedefExplorer,
gdb.TYPE_CODE_ARRAY : ArrayExplorer
}
Explorer.explore_type(name, target_type, is_child)
return False
-
class ArrayExplorer(object):
"""Internal class used to explore arrays."""
/* Return a value which is a reference to the value. */
static PyObject *
-valpy_reference_value (PyObject *self, PyObject *args)
+valpy_reference_value (PyObject *self, PyObject *args, enum type_code refcode)
{
PyObject *result = NULL;
scoped_value_mark free_values;
self_val = ((value_object *) self)->value;
- result = value_to_value_object (value_ref (self_val, TYPE_CODE_REF));
+ result = value_to_value_object (value_ref (self_val, refcode));
}
CATCH (except, RETURN_MASK_ALL)
{
return result;
}
+static PyObject *
+valpy_lvalue_reference_value (PyObject *self, PyObject *args)
+{
+ return valpy_reference_value (self, args, TYPE_CODE_REF);
+}
+
+static PyObject *
+valpy_rvalue_reference_value (PyObject *self, PyObject *args)
+{
+ return valpy_reference_value (self, args, TYPE_CODE_RVALUE_REF);
+}
+
/* Return a "const" qualified version of the value. */
static PyObject *
{
val_type = value_type (v);
val_type = check_typedef (val_type);
- if (TYPE_CODE (val_type) == TYPE_CODE_REF
- || TYPE_CODE (val_type) == TYPE_CODE_PTR)
+ if (TYPE_IS_REFERENCE (val_type) || TYPE_CODE (val_type) == TYPE_CODE_PTR)
val_type = check_typedef (TYPE_TARGET_TYPE (val_type));
type_code = TYPE_CODE (val_type);
else if (TYPE_CODE (val_type) == TYPE_CODE_REF)
res_val = value_cast (lookup_lvalue_reference_type (base_class_type),
tmp);
+ else if (TYPE_CODE (val_type) == TYPE_CODE_RVALUE_REF)
+ res_val = value_cast (lookup_rvalue_reference_type (base_class_type),
+ tmp);
else
res_val = value_cast (base_class_type, tmp);
}
{ "dereference", valpy_dereference, METH_NOARGS, "Dereferences the value." },
{ "referenced_value", valpy_referenced_value, METH_NOARGS,
"Return the value referenced by a TYPE_CODE_REF or TYPE_CODE_PTR value." },
- { "reference_value", valpy_reference_value, METH_NOARGS,
+ { "reference_value", valpy_lvalue_reference_value, METH_NOARGS,
"Return a value of type TYPE_CODE_REF referencing this value." },
+ { "rvalue_reference_value", valpy_rvalue_reference_value, METH_NOARGS,
+ "Return a value of type TYPE_CODE_RVALUE_REF referencing this value." },
{ "const_value", valpy_const_value, METH_NOARGS,
"Return a 'const' qualied version of the same value." },
{ "lazy_string", (PyCFunction) valpy_lazy_string,