diff options
author | Paul N. Hilfinger <hilfinger@adacore.com> | 2009-12-14 06:19:13 +0000 |
---|---|---|
committer | Paul N. Hilfinger <hilfinger@adacore.com> | 2009-12-14 06:19:13 +0000 |
commit | 43bbcdc2bc4ce5748662bceeb206481a6ef63951 (patch) | |
tree | 54a54d486360249d86dca4984253061dbb4735de /gdb/ada-typeprint.c | |
parent | d48d911fbf5511e4faed869ef04a7ea1ccc0850d (diff) | |
download | binutils-gdb-43bbcdc2bc4ce5748662bceeb206481a6ef63951.tar.gz |
* dwarf2read.c (struct attribute): Increase sizes of unsnd and snd
fields to allow larger integer sizes.
(read_subrange_type): Increase size of bound values.
Add logic to determine signedness based on base-type size, signedness.
(read_attribute_value): Change format for bad byte size in message.
(read_8_bytes): Increase size of result type.
(dump_die_shallow): Change format for value.
(dwarf2_get_attr_constant_value): Increase size of return type.
Correct comment.
* gdbtypes.c (create_range_type): Change API to increase size of
bounds. struct field -> union field.
Always take signedness from base type.
(check_typedef): Use new API for TYPE_LOW_BOUND, TYPE_HIGH_BOUND.
(recursive_dump_type, copy_type_recursive): Adjust to new
representation of range types.
* gdbtypes.h (fields_or_bounds): New union containing struct field and
new struct range_bounds, used for range types.
(TYPE_RANGE_DATA): New macro to access range_bounds member.
(TYPE_LOW_BOUND, TYPE_HIGH_BOUND): Represent with new TYPE_RANGE_DATA.
(TYPE_LOW_BOUND_UNDEFINED, TYPE_HIGH_BOUND_UNDEFINED): New macros,
taking over the job of TYPE_FIELD_ARTIFICIAL for range bounds.
(SET_TYPE_LOW_BOUND, SET_TYPE_HIGH_BOUND, SET_TYPE_LOW_BOUND_DEFINED)
(SET_TYPE_HIGH_BOUND_DEFINED): New macros.
(TYPE_FIELDS, TYPE_BASECLASS, TYPE_BASECLASS_NAME, TYPE_FIELD)
(TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED)
(TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED, TYPE_ARRAY_UPPER_BOUND_VALUE)
(TYPE_ARRAY_LOWER_BOUND_VALUE): Adjust to new representation.
(create_range_type): Adjust API.
* ada-lang.c (ada_modulus): Use new extended bound values.
(discrete_type_low_bound): Rename to...
(ada_discrete_type_low_bound): ... and make external.
(discrete_type_high_bound): Rename to...
(ada_discrete_type_high_bound): ... and make external.
(ada_value_slice_from_ptr, ada_array_bound_from_type)
(ada_evaluate_subexp, to_fixed_range_type):
Use ada_discrete_type_low_bound, ada_discrete_type_high_bound.
* ada-typeprint.c (print_range): Use ada_discrete_type_low_bound,
ada_discrete_type_high_bound. Don't look at field count, which
is no longer meaningful. Print bounds whenever argument is a range
or enumeration.
* ada-lang.h (ada_discrete_type_low_bound,ada_discrete_type_high_bound):
Declare.
* varobj.c (c_describe_child): Adjust to render larger values.
* mdebugread.c (parse_type): Use proper abstractions for range types:
TYPE_RANGE_DATA, SET_TYPE_LOW_BOUND_DEFINED,
SET_TYPE_HIGH_BOUND_DEFINED.
* p-typeprint.c (pascal_type_print_varspec_prefix): Use larger format
for bounds.
Diffstat (limited to 'gdb/ada-typeprint.c')
-rw-r--r-- | gdb/ada-typeprint.c | 49 |
1 files changed, 14 insertions, 35 deletions
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index fe902e2e684..02f50bbb7d2 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -114,53 +114,32 @@ decoded_type_name (struct type *type) } } -/* Print range type TYPE on STREAM. */ +/* Print TYPE on STREAM, preferably as a range. */ static void print_range (struct type *type, struct ui_file *stream) { - struct type *target_type; - target_type = TYPE_TARGET_TYPE (type); - if (target_type == NULL) - target_type = type; - - switch (TYPE_CODE (target_type)) + switch (TYPE_CODE (type)) { case TYPE_CODE_RANGE: - case TYPE_CODE_INT: - case TYPE_CODE_BOOL: - case TYPE_CODE_CHAR: case TYPE_CODE_ENUM: + { + struct type *target_type; + target_type = TYPE_TARGET_TYPE (type); + if (target_type == NULL) + target_type = type; + ada_print_scalar (target_type, ada_discrete_type_low_bound (type), + stream); + fprintf_filtered (stream, " .. "); + ada_print_scalar (target_type, ada_discrete_type_high_bound (type), + stream); + } break; default: - target_type = NULL; - break; - } - - if (TYPE_NFIELDS (type) < 2) - { - /* A range needs at least 2 bounds to be printed. If there are less - than 2, just print the type name instead of the range itself. - This check handles cases such as characters, for example. - - If the name is not defined, then we don't print anything. - */ fprintf_filtered (stream, "%.*s", ada_name_prefix_len (TYPE_NAME (type)), TYPE_NAME (type)); - } - else - { - /* We extract the range type bounds respectively from the first element - and the last element of the type->fields array */ - const LONGEST lower_bound = (LONGEST) TYPE_LOW_BOUND (type); - const LONGEST upper_bound = (TYPE_CODE (type) == TYPE_CODE_RANGE - ? (LONGEST) TYPE_HIGH_BOUND (type) - : (LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1)); - - ada_print_scalar (target_type, lower_bound, stream); - fprintf_filtered (stream, " .. "); - ada_print_scalar (target_type, upper_bound, stream); + break; } } |