summaryrefslogtreecommitdiff
path: root/gdb/python/py-xmethods.c
diff options
context:
space:
mode:
authorArtemiy Volkov <artemiyv@acm.org>2017-03-20 13:47:52 -0700
committerKeith Seitz <keiths@redhat.com>2017-03-20 13:47:52 -0700
commit3fcf899da106890f3948093c2424f9dff67d6fe0 (patch)
tree6adbeb1b3226c93d0240095dd10ba92430c4c131 /gdb/python/py-xmethods.c
parent4297a3f0029974c62628d69b6f3f9ef25f01ea7d (diff)
downloadbinutils-gdb-3fcf899da106890f3948093c2424f9dff67d6fe0.tar.gz
Support rvalue references in the gdb python module (includes doc/)
This patch adds the ability to inspect rvalue reference types and values using the gdb python module. This is achieved by creating two wrappers for valpy_reference_value(), using the ReferenceExplorer class to handle the objects of rvalue reference types and placing necessary checks for a TYPE_CODE_RVALUE_REF type code next to the checks for a TYPE_CODE_REF type code. gdb/ChangeLog 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.
Diffstat (limited to 'gdb/python/py-xmethods.c')
-rw-r--r--gdb/python/py-xmethods.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c
index d01488fc744..e061da2192b 100644
--- a/gdb/python/py-xmethods.c
+++ b/gdb/python/py-xmethods.c
@@ -464,9 +464,10 @@ gdbpy_get_xmethod_result_type (const struct extension_language_defn *extlang,
if (!types_equal (obj_type, this_ptr))
obj = value_cast (this_ptr, obj);
}
- else if (TYPE_CODE (obj_type) == TYPE_CODE_REF)
+ else if (TYPE_IS_REFERENCE (obj_type))
{
- struct type *this_ref = lookup_lvalue_reference_type (this_type);
+ struct type *this_ref
+ = lookup_reference_type (this_type, TYPE_CODE (obj_type));
if (!types_equal (obj_type, this_ref))
obj = value_cast (this_ref, obj);