This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Variable objects: references formatting
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 03 May 2006 13:21:00 +0400
- Subject: Variable objects: references formatting
Hi!
At the moment, when using variable objects to display a struct or a class,
the result of -data-evaluate-expression is "...". However, when displaying
a reference to a class, the result of -data-evaluate-expression is
{}-enclosed list of members and their values.
This disparity does not seem to be reasonable, the attached patch fixes it:
Changelog:
2006-05-03 Vladimir Prus <ghost@cs.msu.su>
varobj.c (c_value_of_variable): Ignore top-level references.
Patch attached.
Thanks,
Volodya
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.58
diff -u -r1.58 varobj.c
@@ -2055,8 +2219,14 @@
{
/* BOGUS: if val_print sees a struct/class, it will print out its
children instead of "{...}" */
+ struct type* type = get_type (var);
+ /* Strip top-level references. */
+ while (TYPE_CODE (type) == TYPE_CODE_REF)
+ {
+ type = TYPE_TARGET_TYPE (type);
+ }
- switch (TYPE_CODE (get_type (var)))
+ switch (TYPE_CODE (type))
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION: