aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-01-03 13:11:51 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-01-03 13:11:51 +0000
commitf192137b09a5f99ef0ab14f19cb7160871f25963 (patch)
treee2de2ee66ae96bb0432f5d40e68822bcae4f6937 /gdb
parent1ed6ede0102f09c717fb707bd27e7d224c77f9ef (diff)
downloadgdb-f192137b09a5f99ef0ab14f19cb7160871f25963.zip
gdb-f192137b09a5f99ef0ab14f19cb7160871f25963.tar.gz
gdb-f192137b09a5f99ef0ab14f19cb7160871f25963.tar.bz2
* ada-lang.c (static_unwrap_type): Add forward declaration.
(template_to_static_fixed_type): Fields of dynamic types sometimes also need to be unwrapped. Take this into account. (ada_to_fixed_type_1): Renamed from ada_to_fixed_type. (ada_to_fixed_type): New wrapper around ada_to_fixed_type_1. * ada-typeprint.c (ada_print_type): Get the typename from the original type, not the base type.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/ada-lang.c26
-rw-r--r--gdb/ada-typeprint.c2
3 files changed, 34 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2434672..67cfd7e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-03 Joel Brobecker <brobecker@adacore.com>
+
+ * ada-lang.c (static_unwrap_type): Add forward declaration.
+ (template_to_static_fixed_type): Fields of dynamic types sometimes
+ also need to be unwrapped. Take this into account.
+ (ada_to_fixed_type_1): Renamed from ada_to_fixed_type.
+ (ada_to_fixed_type): New wrapper around ada_to_fixed_type_1.
+ * ada-typeprint.c (ada_print_type): Get the typename from
+ the original type, not the base type.
+
2008-01-03 Jerome Guitton <guitton@adacore.com>
* ada-lang.c (ada_value_struct_elt, to_fixed_array_type)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index fcb3b05..76fe71a 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -181,6 +181,7 @@ static struct type *to_fixed_range_type (char *, struct value *,
struct objfile *);
static struct type *to_static_fixed_type (struct type *);
+static struct type *static_unwrap_type (struct type *type);
static struct value *unwrap_value (struct value *);
@@ -6854,7 +6855,7 @@ template_to_static_fixed_type (struct type *type0)
if (is_dynamic_field (type0, f))
new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type));
else
- new_type = to_static_fixed_type (field_type);
+ new_type = static_unwrap_type (field_type);
if (type == type0 && new_type != field_type)
{
TYPE_TARGET_TYPE (type0) = type = alloc_type (TYPE_OBJFILE (type0));
@@ -7125,8 +7126,8 @@ to_fixed_array_type (struct type *type0, struct value *dval,
location of the tag, and therefore compute the tagged type's actual type.
So we return the tagged type without consulting the tag. */
-struct type *
-ada_to_fixed_type (struct type *type, const gdb_byte *valaddr,
+static struct type *
+ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
CORE_ADDR address, struct value *dval, int check_tag)
{
type = ada_check_typedef (type);
@@ -7168,6 +7169,25 @@ ada_to_fixed_type (struct type *type, const gdb_byte *valaddr,
}
}
+/* The same as ada_to_fixed_type_1, except that it preserves the type
+ if it is a TYPE_CODE_TYPEDEF of a type that is already fixed.
+ ada_to_fixed_type_1 would return the type referenced by TYPE. */
+
+struct type *
+ada_to_fixed_type (struct type *type, const gdb_byte *valaddr,
+ CORE_ADDR address, struct value *dval, int check_tag)
+
+{
+ struct type *fixed_type =
+ ada_to_fixed_type_1 (type, valaddr, address, dval, check_tag);
+
+ if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF
+ && TYPE_TARGET_TYPE (type) == fixed_type)
+ return type;
+
+ return fixed_type;
+}
+
/* A standard (static-sized) type corresponding as well as possible to
TYPE0, but based on no runtime data. */
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 8532d6a..7bfb001 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -753,7 +753,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
int show, int level)
{
struct type *type = ada_check_typedef (ada_get_base_type (type0));
- char *type_name = decoded_type_name (type);
+ char *type_name = decoded_type_name (type0);
int is_var_decl = (varstring != NULL && varstring[0] != '\0');
if (type == NULL)