- 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);
+ LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
+ int got_error = 0;
+
+ try
+ {
+ lo = ada_discrete_type_low_bound (type);
+ hi = ada_discrete_type_high_bound (type);
+ }
+ catch (const gdb_exception_error &e)
+ {
+ /* This can happen when the range is dynamic. Sometimes,
+ resolving dynamic property values requires us to have
+ access to an actual object, which is not available
+ when the user is using the "ptype" command on a type.
+ Print the range as an unbounded range. */
+ fprintf_filtered (stream, "<>");
+ got_error = 1;
+ }
+
+ if (!got_error)
+ {
+ ada_print_scalar (type, lo, stream);
+ fprintf_filtered (stream, " .. ");
+ ada_print_scalar (type, hi, stream);
+ }