diff options
author | Joel Brobecker <brobecker@gnat.com> | 2010-05-17 16:55:30 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2010-05-17 16:55:30 +0000 |
commit | 2555021299e4aabfc635f6eec61bd093d57b9d72 (patch) | |
tree | fb955bc2a0b1d77219a3eb05282b4644b7f442eb /gdb/ada-typeprint.c | |
parent | ba17b7cc6eafadbb6f94ca307ee5e955c7cda506 (diff) | |
download | gdb-2555021299e4aabfc635f6eec61bd093d57b9d72.tar.gz |
Avoid global lookup when decoding XA type.
This patch enhances GDB to take advantage of a recent change in the GNAT
encoding regarding XA types. A detailed description of the logic has
been added at the start of ada_fixup_array_indexes_type to give the
context behind this enhancement.
2010-05-17 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (to_fixed_range_type): The the raw index type as
argument instead of the raw type name. Remove orig_type parameter.
Update calls throughout.
(ada_fixup_array_indexes_type): New function.
(ada_array_bound_from_type): Add call to ada_fixup_array_indexes_type.
* ada-lang.h (ada_fixup_array_indexes_type): Add declaration.
* ada-typeprint.c (print_range_type): Renames print_range_type_named.
Remove name parameter.
(print_array_type): Add call to ada_fixup_array_indexes_type.
Update calls to print_range_type.
(ada_print_type): Update calls to print_range_type.
Diffstat (limited to 'gdb/ada-typeprint.c')
-rw-r--r-- | gdb/ada-typeprint.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index 17d3594250d..b69deabe454 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -55,7 +55,7 @@ static void print_dynamic_range_bound (struct type *, const char *, int, const char *, struct ui_file *); -static void print_range_type_named (char *, struct type *, struct ui_file *); +static void print_range_type (struct type *, struct ui_file *); @@ -212,19 +212,19 @@ print_dynamic_range_bound (struct type *type, const char *name, int name_len, fprintf_filtered (stream, "?"); } -/* Print the range type named NAME. If symbol lookup fails, fall back - to ORIG_TYPE as base type. */ +/* Print RAW_TYPE as a range type, using any bound information + following the GNAT encoding (if available). */ static void -print_range_type_named (char *name, struct type *orig_type, - struct ui_file *stream) +print_range_type (struct type *raw_type, struct ui_file *stream) { - struct type *raw_type = ada_find_any_type (name); + char *name; struct type *base_type; char *subtype_info; - if (raw_type == NULL) - raw_type = orig_type; + gdb_assert (raw_type != NULL); + name = TYPE_NAME (raw_type); + gdb_assert (name != NULL); if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) base_type = TYPE_TARGET_TYPE (raw_type); @@ -341,10 +341,12 @@ print_array_type (struct type *type, struct ui_file *stream, int show, { if (ada_is_simple_array_type (type)) { - struct type *range_desc_type = - ada_find_parallel_type (type, "___XA"); + struct type *range_desc_type; struct type *arr_type; + range_desc_type = ada_find_parallel_type (type, "___XA"); + ada_fixup_array_indexes_type (range_desc_type); + bitsize = 0; if (range_desc_type == NULL) { @@ -368,9 +370,8 @@ print_array_type (struct type *type, struct ui_file *stream, int show, { if (k > 0) fprintf_filtered (stream, ", "); - print_range_type_named (TYPE_FIELD_NAME - (range_desc_type, k), - TYPE_INDEX_TYPE (arr_type), stream); + print_range_type (TYPE_FIELD_TYPE (range_desc_type, k), + stream); if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); } @@ -786,7 +787,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream, else { fprintf_filtered (stream, "range "); - print_range_type_named (name, type, stream); + print_range_type (type, stream); } } break; |