aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-valprint.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-03-29 20:37:19 +0000
committerDaniel Jacobowitz <drow@false.org>2005-03-29 20:37:19 +0000
commit887503049333627249f06ae0c7c44d66dc62ffc6 (patch)
treed608eedd05d79d4f50ffd72c11f16d88805a2c19 /gdb/c-valprint.c
parent15b6c49f149f84ce4a75e93c8429daac2678e758 (diff)
downloadgdb-887503049333627249f06ae0c7c44d66dc62ffc6.zip
gdb-887503049333627249f06ae0c7c44d66dc62ffc6.tar.gz
gdb-887503049333627249f06ae0c7c44d66dc62ffc6.tar.bz2
* c-valprint.c (c_value_print): Fix up some formatting. Use
check_typedef. testsuite/ * gdb.base/ptr-typedef.exp, gdb.base/ptr-typedef.c: New files.
Diffstat (limited to 'gdb/c-valprint.c')
-rw-r--r--gdb/c-valprint.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 0e06ca6..0a4255e 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -491,8 +491,7 @@ int
c_value_print (struct value *val, struct ui_file *stream, int format,
enum val_prettyprint pretty)
{
- struct type *type = value_type (val);
- struct type *real_type;
+ struct type *type, *real_type;
int full, top, using_enc;
/* If it is a pointer, indicate what it points to.
@@ -501,15 +500,18 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
C++: if it is a member pointer, we will take care
of that when we print it. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR ||
- TYPE_CODE (type) == TYPE_CODE_REF)
+
+ type = check_typedef (value_type (val));
+
+ if (TYPE_CODE (type) == TYPE_CODE_PTR
+ || TYPE_CODE (type) == TYPE_CODE_REF)
{
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR &&
- TYPE_NAME (type) == NULL &&
- TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL &&
- strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
+ if (TYPE_CODE (type) == TYPE_CODE_PTR
+ && TYPE_NAME (type) == NULL
+ && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
+ && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
{
/* Print nothing */
}
@@ -556,11 +558,12 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
{
/* normal case */
fprintf_filtered (stream, "(");
- type_print (type, "", stream, -1);
+ type_print (value_type (val), "", stream, -1);
fprintf_filtered (stream, ") ");
}
}
- if (objectprint && (TYPE_CODE (value_type (val)) == TYPE_CODE_CLASS))
+
+ if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
{
/* Attempt to determine real type of object */
real_type = value_rtti_type (val, &full, &top, &using_enc);
@@ -578,7 +581,7 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
/* Note: When we look up RTTI entries, we don't get any information on
const or volatile attributes */
}
- else if (type != value_enclosing_type (val))
+ else if (type != check_typedef (value_enclosing_type (val)))
{
/* No RTTI information, so let's do our best */
fprintf_filtered (stream, "(%s ?) ",