From 14b3d9c967b5ad2b6022069fc84bbc7541d3f977 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 3 May 2006 22:59:38 +0000 Subject: [PATCH] gdb/ChangeLog: 2006-05-03 Vladimir Prus * varobj.c (c_value_of_variable): Ignore top-level references. (Committed by Jim Blandy.) --- gdb/ChangeLog | 5 +++++ gdb/varobj.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2dd5f42cef..1d40c3007c1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2006-05-03 Vladimir Prus + + * varobj.c (c_value_of_variable): Ignore top-level references. + (Committed by Jim Blandy.) + 2006-04-30 Mark Kettenis * breakpoint.c (insert_single_step_breakpoint): Make a failure to diff --git a/gdb/varobj.c b/gdb/varobj.c index c16e08819fe..c664bfd0975 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -2054,10 +2054,16 @@ c_variable_editable (struct varobj *var) static char * c_value_of_variable (struct varobj *var) { - /* BOGUS: if val_print sees a struct/class, it will print out its - children instead of "{...}" */ + /* BOGUS: if val_print sees a struct/class, or a reference to one, + it will print out its children instead of "{...}". So we need to + catch that case explicitly. */ + struct type *type = get_type (var); - switch (TYPE_CODE (get_type (var))) + /* Strip top-level references. */ + while (TYPE_CODE (type) == TYPE_CODE_REF) + type = check_typedef (TYPE_TARGET_TYPE (type)); + + switch (TYPE_CODE (type)) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: -- 2.30.2