diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2009-06-29 17:28:59 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2009-06-29 17:28:59 +0000 |
commit | 1ce677a4a194224337e88b3b6d365b5dd66714bd (patch) | |
tree | 2c9686264a3f96bb2f7613db99bc57c4312c14a1 /gdb/ada-typeprint.c | |
parent | * ada-lang.c (ada_index_type): Update comment. (diff) | |
download | binutils-gdb-1ce677a4a194224337e88b3b6d365b5dd66714bd.tar.gz binutils-gdb-1ce677a4a194224337e88b3b6d365b5dd66714bd.tar.bz2 binutils-gdb-1ce677a4a194224337e88b3b6d365b5dd66714bd.zip |
* ada-lang.c (to_fixed_range_type): Add ORIG_TYPE argument.
Fall back to orig_type as index type if symbol lookup fails.
Allocate result types from ORIG_TYPE's objfile.
(ada_array_bound_from_type, to_fixed_array_type,
ada_evaluate_subexp): Pass original index type to
to_fixed_range_type. Do not pass objfile.
* ada-typeprint.c (print_range_type_named): Add ORIG_TYPE argument.
Fall back to orig_type as index type if symbol lookup fails.
(print_array_type, ada_print_type): Pass original index type
to print_range_type_named.
Diffstat (limited to 'gdb/ada-typeprint.c')
-rw-r--r-- | gdb/ada-typeprint.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index ef665c4a0c1..f4f925c0874 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 ui_file *); +static void print_range_type_named (char *, struct type *, struct ui_file *); @@ -233,26 +233,27 @@ print_dynamic_range_bound (struct type *type, const char *name, int name_len, fprintf_filtered (stream, "?"); } -/* Print the range type named NAME. */ +/* Print the range type named NAME. If symbol lookup fails, fall back + to ORIG_TYPE as base type. */ static void -print_range_type_named (char *name, struct ui_file *stream) +print_range_type_named (char *name, struct type *orig_type, + struct ui_file *stream) { struct type *raw_type = ada_find_any_type (name); struct type *base_type; char *subtype_info; if (raw_type == NULL) - base_type = builtin_type_int32; - else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) + raw_type = orig_type; + + if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) base_type = TYPE_TARGET_TYPE (raw_type); else base_type = raw_type; subtype_info = strstr (name, "___XD"); - if (subtype_info == NULL && raw_type == NULL) - fprintf_filtered (stream, "? .. ?"); - else if (subtype_info == NULL) + if (subtype_info == NULL) print_range (raw_type, stream); else { @@ -398,7 +399,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), stream); + (range_desc_type, k), + TYPE_INDEX_TYPE (arr_type), stream); if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); } @@ -816,7 +818,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream, else { fprintf_filtered (stream, "range "); - print_range_type_named (name, stream); + print_range_type_named (name, type, stream); } } break; |