[PATCH] PR gdb/14077: Dynamic type of references cannot be accessed
André Pönitz
andre.poenitz@mathematik.tu-chemnitz.de
Thu May 10 21:54:00 GMT 2012
This patch fixes http://sourceware.org/bugzilla/show_bug.cgi?id=14077
for me.
It allows gdb to use dynamic_type on gdb.Value objects that represent
C++ references, similar to what already works with pointers.
Andre'
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f79f1ef..cb9be25 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-10 André Pönitz <andre.poenitz@nokia.com>
+
+ * python/py-value.c (valpy_get_dynamic_type): Call coerce_ref
+ for references.
+
2012-05-10 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (recursively_write_psymbols): New function.
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 6f67bdb..bfb7260 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -310,7 +310,11 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
struct value *target;
int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
- target = value_ind (val);
+ if (was_pointer)
+ target = value_ind (val);
+ else
+ target = coerce_ref (val);
+
type = value_rtti_type (target, NULL, NULL, NULL);
if (type)
More information about the Gdb-patches
mailing list