static struct value *unwrap_value (struct value *);
-static struct type *packed_array_type (struct type *, long *);
+static struct type *constrained_packed_array_type (struct type *, long *);
-static struct type *decode_packed_array_type (struct type *);
+static struct type *decode_constrained_packed_array_type (struct type *);
-static struct value *decode_packed_array (struct value *);
+static long decode_packed_array_bitsize (struct type *);
+
+static struct value *decode_constrained_packed_array (struct value *);
+
+static int ada_is_packed_array_type (struct type *);
+
+static int ada_is_unconstrained_packed_array_type (struct type *);
static struct value *value_subscript_packed (struct value *, int,
struct value **);
}
/* The largest value in the domain of TYPE, a discrete type, as an integer. */
-static LONGEST
-discrete_type_high_bound (struct type *type)
+LONGEST
+ada_discrete_type_high_bound (struct type *type)
{
switch (TYPE_CODE (type))
{
case TYPE_CODE_INT:
return max_of_type (type);
default:
- error (_("Unexpected type in discrete_type_high_bound."));
+ error (_("Unexpected type in ada_discrete_type_high_bound."));
}
}
/* The largest value in the domain of TYPE, a discrete type, as an integer. */
-static LONGEST
-discrete_type_low_bound (struct type *type)
+LONGEST
+ada_discrete_type_low_bound (struct type *type)
{
switch (TYPE_CODE (type))
{
case TYPE_CODE_INT:
return min_of_type (type);
default:
- error (_("Unexpected type in discrete_type_low_bound."));
+ error (_("Unexpected type in ada_discrete_type_low_bound."));
}
}
*len = *len - 1;
}
+/* Remove trailing X[bn]* suffixes (indicating names in package bodies). */
+
+static void
+ada_remove_Xbn_suffix (const char *encoded, int *len)
+{
+ int i = *len - 1;
+
+ while (i > 0 && (encoded[i] == 'b' || encoded[i] == 'n'))
+ i--;
+
+ if (encoded[i] != 'X')
+ return;
+
+ if (i == 0)
+ return;
+
+ if (isalnum (encoded[i-1]))
+ *len = i;
+}
+
/* If ENCODED follows the GNAT entity encoding conventions, then return
the decoded form of ENCODED. Otherwise, return "<%s>" where "%s" is
replaced by ENCODED.
if (len0 > 3 && strncmp (encoded + len0 - 3, "TKB", 3) == 0)
len0 -= 3;
+ /* Remove any trailing TB suffix. The TB suffix is slightly different
+ from the TKB suffix because it is used for non-anonymous task
+ bodies. */
+
+ if (len0 > 2 && strncmp (encoded + len0 - 2, "TB", 2) == 0)
+ len0 -= 2;
+
/* Remove trailing "B" suffixes. */
/* FIXME: brobecker/2006-04-19: Not sure what this are used for... */
struct type *
ada_type_of_array (struct value *arr, int bounds)
{
- if (ada_is_packed_array_type (value_type (arr)))
- return decode_packed_array_type (value_type (arr));
+ if (ada_is_constrained_packed_array_type (value_type (arr)))
+ return decode_constrained_packed_array_type (value_type (arr));
if (!ada_is_array_descriptor_type (value_type (arr)))
return value_type (arr);
if (!bounds)
- return
- ada_check_typedef (desc_data_target_type (value_type (arr)));
+ {
+ struct type *array_type =
+ ada_check_typedef (desc_data_target_type (value_type (arr)));
+
+ if (ada_is_unconstrained_packed_array_type (value_type (arr)))
+ TYPE_FIELD_BITSIZE (array_type, 0) =
+ decode_packed_array_bitsize (value_type (arr));
+
+ return array_type;
+ }
else
{
struct type *elt_type;
longest_to_int (value_as_long (low)),
longest_to_int (value_as_long (high)));
elt_type = create_array_type (array_type, elt_type, range_type);
+
+ if (ada_is_unconstrained_packed_array_type (value_type (arr)))
+ TYPE_FIELD_BITSIZE (elt_type, 0) =
+ decode_packed_array_bitsize (value_type (arr));
}
return lookup_pointer_type (elt_type);
return NULL;
return value_cast (arrType, value_copy (desc_data (arr)));
}
- else if (ada_is_packed_array_type (value_type (arr)))
- return decode_packed_array (arr);
+ else if (ada_is_constrained_packed_array_type (value_type (arr)))
+ return decode_constrained_packed_array (arr);
else
return arr;
}
check_size (TYPE_TARGET_TYPE (value_type (arrVal)));
return value_ind (arrVal);
}
- else if (ada_is_packed_array_type (value_type (arr)))
- return decode_packed_array (arr);
+ else if (ada_is_constrained_packed_array_type (value_type (arr)))
+ return decode_constrained_packed_array (arr);
else
return arr;
}
struct type *
ada_coerce_to_simple_array_type (struct type *type)
{
- if (ada_is_packed_array_type (type))
- return decode_packed_array_type (type);
+ if (ada_is_constrained_packed_array_type (type))
+ return decode_constrained_packed_array_type (type);
if (ada_is_array_descriptor_type (type))
return ada_check_typedef (desc_data_target_type (type));
/* Non-zero iff TYPE represents a standard GNAT packed-array type. */
-int
-ada_is_packed_array_type (struct type *type)
+static int
+ada_is_packed_array_type (struct type *type)
{
if (type == NULL)
return 0;
&& strstr (ada_type_name (type), "___XP") != NULL;
}
+/* Non-zero iff TYPE represents a standard GNAT constrained
+ packed-array type. */
+
+int
+ada_is_constrained_packed_array_type (struct type *type)
+{
+ return ada_is_packed_array_type (type)
+ && !ada_is_array_descriptor_type (type);
+}
+
+/* Non-zero iff TYPE represents an array descriptor for a
+ unconstrained packed-array type. */
+
+static int
+ada_is_unconstrained_packed_array_type (struct type *type)
+{
+ return ada_is_packed_array_type (type)
+ && ada_is_array_descriptor_type (type);
+}
+
+/* Given that TYPE encodes a packed array type (constrained or unconstrained),
+ return the size of its elements in bits. */
+
+static long
+decode_packed_array_bitsize (struct type *type)
+{
+ char *raw_name = ada_type_name (ada_check_typedef (type));
+ char *tail;
+ long bits;
+
+ if (!raw_name)
+ raw_name = ada_type_name (desc_base_type (type));
+
+ if (!raw_name)
+ return 0;
+
+ tail = strstr (raw_name, "___XP");
+
+ if (sscanf (tail + sizeof ("___XP") - 1, "%ld", &bits) != 1)
+ {
+ lim_warning
+ (_("could not understand bit size information on packed array"));
+ return 0;
+ }
+
+ return bits;
+}
+
/* Given that TYPE is a standard GDB array type with all bounds filled
in, and that the element size of its ultimate scalar constituents
(that is, either its elements, or, if it is an array of arrays, its
in bits. */
static struct type *
-packed_array_type (struct type *type, long *elt_bits)
+constrained_packed_array_type (struct type *type, long *elt_bits)
{
struct type *new_elt_type;
struct type *new_type;
return type;
new_type = alloc_type_copy (type);
- new_elt_type = packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (type)),
- elt_bits);
+ new_elt_type =
+ constrained_packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (type)),
+ elt_bits);
create_array_type (new_type, new_elt_type, TYPE_INDEX_TYPE (type));
TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
TYPE_NAME (new_type) = ada_type_name (type);
return new_type;
}
-/* The array type encoded by TYPE, where ada_is_packed_array_type (TYPE). */
+/* The array type encoded by TYPE, where
+ ada_is_constrained_packed_array_type (TYPE). */
static struct type *
-decode_packed_array_type (struct type *type)
+decode_constrained_packed_array_type (struct type *type)
{
struct symbol *sym;
struct block **blocks;
return NULL;
}
- if (sscanf (tail + sizeof ("___XP") - 1, "%ld", &bits) != 1)
- {
- lim_warning
- (_("could not understand bit size information on packed array"));
- return NULL;
- }
-
- return packed_array_type (shadow_type, &bits);
+ bits = decode_packed_array_bitsize (type);
+ return constrained_packed_array_type (shadow_type, &bits);
}
-/* Given that ARR is a struct value *indicating a GNAT packed array,
- returns a simple array that denotes that array. Its type is a
+/* Given that ARR is a struct value *indicating a GNAT constrained packed
+ array, returns a simple array that denotes that array. Its type is a
standard GDB array type except that the BITSIZEs of the array
target types are set to the number of bits in each element, and the
type length is set appropriately. */
static struct value *
-decode_packed_array (struct value *arr)
+decode_constrained_packed_array (struct value *arr)
{
struct type *type;
if (TYPE_CODE (value_type (arr)) == TYPE_CODE_PTR)
arr = value_ind (arr);
- type = decode_packed_array_type (value_type (arr));
+ type = decode_constrained_packed_array_type (value_type (arr));
if (type == NULL)
{
error (_("can't unpack array"));
move_bits (buffer, value_bitpos (toval),
value_contents (fromval), 0, bits, 0);
write_memory (to_addr, buffer, len);
- if (deprecated_memory_changed_hook)
- deprecated_memory_changed_hook (to_addr, len);
-
+ observer_notify_memory_changed (to_addr, len, buffer);
+
val = value_copy (toval);
memcpy (value_contents_raw (val), value_contents (fromval),
TYPE_LENGTH (type));
int low, int high)
{
CORE_ADDR base = value_as_address (array_ptr)
- + ((low - TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)))
+ + ((low - ada_discrete_type_low_bound (TYPE_INDEX_TYPE (type)))
* TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
struct type *index_type =
create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type)),
ada_array_bound_from_type (struct type * arr_type, int n, int which)
{
struct type *type, *elt_type, *index_type_desc, *index_type;
- LONGEST retval;
int i;
gdb_assert (which == 0 || which == 1);
- if (ada_is_packed_array_type (arr_type))
- arr_type = decode_packed_array_type (arr_type);
+ if (ada_is_constrained_packed_array_type (arr_type))
+ arr_type = decode_constrained_packed_array_type (arr_type);
if (arr_type == NULL || !ada_is_simple_array_type (arr_type))
return (LONGEST) - which;
else
index_type = TYPE_INDEX_TYPE (elt_type);
- switch (TYPE_CODE (index_type))
- {
- case TYPE_CODE_RANGE:
- retval = which == 0 ? TYPE_LOW_BOUND (index_type)
- : TYPE_HIGH_BOUND (index_type);
- break;
- case TYPE_CODE_ENUM:
- retval = which == 0 ? TYPE_FIELD_BITPOS (index_type, 0)
- : TYPE_FIELD_BITPOS (index_type,
- TYPE_NFIELDS (index_type) - 1);
- break;
- default:
- internal_error (__FILE__, __LINE__, _("invalid type code of index type"));
- }
-
- return retval;
+ return
+ (LONGEST) (which == 0
+ ? ada_discrete_type_low_bound (index_type)
+ : ada_discrete_type_high_bound (index_type));
}
/* Given that arr is an array value, returns the lower bound of the
{
struct type *arr_type = value_type (arr);
- if (ada_is_packed_array_type (arr_type))
- return ada_array_bound (decode_packed_array (arr), n, which);
+ if (ada_is_constrained_packed_array_type (arr_type))
+ return ada_array_bound (decode_constrained_packed_array (arr), n, which);
else if (ada_is_simple_array_type (arr_type))
return ada_array_bound_from_type (arr_type, n, which);
else
{
struct type *arr_type = ada_check_typedef (value_type (arr));
- if (ada_is_packed_array_type (arr_type))
- return ada_array_length (decode_packed_array (arr), n);
+ if (ada_is_constrained_packed_array_type (arr_type))
+ return ada_array_length (decode_constrained_packed_array (arr), n);
if (ada_is_simple_array_type (arr_type))
return (ada_array_bound_from_type (arr_type, n, 1)
/* Return non-zero if formal type FTYPE matches actual type ATYPE. If
MAY_DEREF is non-zero, the formal may be a pointer and the actual
- a non-pointer. A type of 'void' (which is never a valid expression type)
- by convention matches anything. */
+ a non-pointer. */
/* The term "match" here is rather loose. The match is heuristic and
- liberal. FIXME: TOO liberal, in fact. */
+ liberal. */
static int
ada_type_match (struct type *ftype, struct type *atype, int may_deref)
if (TYPE_CODE (atype) == TYPE_CODE_REF)
atype = TYPE_TARGET_TYPE (atype);
- if (TYPE_CODE (ftype) == TYPE_CODE_VOID
- || TYPE_CODE (atype) == TYPE_CODE_VOID)
- return 1;
-
switch (TYPE_CODE (ftype))
{
default:
- return 1;
+ return TYPE_CODE (ftype) == TYPE_CODE (atype);
case TYPE_CODE_PTR:
if (TYPE_CODE (atype) == TYPE_CODE_PTR)
return ada_type_match (TYPE_TARGET_TYPE (ftype),
case TYPE_CODE_INT:
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
+ case TYPE_CODE_BOOL:
return 1;
default:
return 0;
the XR type name, we need to make sure that this suffix is
not included. So do not include any suffix in the function
name length below. */
- const int function_name_len = ada_name_prefix_len (function_name);
+ int function_name_len = ada_name_prefix_len (function_name);
const int rename_len = function_name_len + 2 /* "__" */
+ strlen (name) + 6 /* "___XR\0" */ ;
/* Strip the suffix if necessary. */
- function_name[function_name_len] = '\0';
+ ada_remove_trailing_digits (function_name, &function_name_len);
+ ada_remove_po_subprogram_suffix (function_name, &function_name_len);
+ ada_remove_Xbn_suffix (function_name, &function_name_len);
/* Library-level functions are a special case, as GNAT adds
a ``_ada_'' prefix to the function name to avoid namespace
have this prefix, so we need to skip this prefix if present. */
if (function_name_len > 5 /* "_ada_" */
&& strstr (function_name, "_ada_") == function_name)
- function_name = function_name + 5;
+ {
+ function_name += 5;
+ function_name_len -= 5;
+ }
rename = (char *) alloca (rename_len * sizeof (char));
- xsnprintf (rename, rename_len * sizeof (char), "%s__%s___XR",
- function_name, name);
+ strncpy (rename, function_name, function_name_len);
+ xsnprintf (rename + function_name_len, rename_len - function_name_len,
+ "__%s___XR", name);
}
else
{
return 0;
else if (TYPE_NAME (type1) == NULL && TYPE_NAME (type0) != NULL)
return 1;
- else if (ada_is_packed_array_type (type0))
+ else if (ada_is_constrained_packed_array_type (type0))
return 1;
else if (ada_is_array_descriptor_type (type0)
&& !ada_is_array_descriptor_type (type1))
{
struct type *index_type_desc;
struct type *result;
- int packed_array_p;
+ int constrained_packed_array_p;
if (TYPE_FIXED_INSTANCE (type0))
return type0;
- packed_array_p = ada_is_packed_array_type (type0);
- if (packed_array_p)
- type0 = decode_packed_array_type (type0);
+ constrained_packed_array_p = ada_is_constrained_packed_array_type (type0);
+ if (constrained_packed_array_p)
+ type0 = decode_constrained_packed_array_type (type0);
index_type_desc = ada_find_parallel_type (type0, "___XA");
if (index_type_desc == NULL)
/* Make sure we always create a new array type when dealing with
packed array types, since we're going to fix-up the array
type length and element bitsize a little further down. */
- if (elt_type0 == elt_type && !packed_array_p)
+ if (elt_type0 == elt_type && !constrained_packed_array_p)
result = type0;
else
result = create_array_type (alloc_type_copy (type0),
error (_("array type with dynamic size is larger than varsize-limit"));
}
- if (packed_array_p)
+ if (constrained_packed_array_p)
{
/* So far, the resulting type has been created as if the original
type was a regular (non-packed) array type. As a result, the
/* Evaluating Ada expressions, and printing their result.
------------------------------------------------------
+ 1. Introduction:
+ ----------------
+
We usually evaluate an Ada expression in order to print its value.
We also evaluate an expression in order to print its type, which
happens during the EVAL_AVOID_SIDE_EFFECTS phase of the evaluation,
cleaned up, this guide might become redundant with the comments
inserted in the code, and we might want to remove it.
+ 2. ``Fixing'' an Entity, the Simple Case:
+ -----------------------------------------
+
When evaluating Ada expressions, the tricky issue is that they may
reference entities whose type contents and size are not statically
known. Consider for instance a variant record:
such as an array of variant records, for instance. There are
two possible cases: Arrays, and records.
- Arrays are a little simpler to handle, because the same amount of
- memory is allocated for each element of the array, even if the amount
- of space used by each element changes from element to element.
- Consider for instance the following array of type Rec:
+ 3. ``Fixing'' Arrays:
+ ---------------------
+
+ The type structure in GDB describes an array in terms of its bounds,
+ and the type of its elements. By design, all elements in the array
+ have the same type and we cannot represent an array of variant elements
+ using the current type structure in GDB. When fixing an array,
+ we cannot fix the array element, as we would potentially need one
+ fixed type per element of the array. As a result, the best we can do
+ when fixing an array is to produce an array whose bounds and size
+ are correct (allowing us to read it from memory), but without having
+ touched its element type. Fixing each element will be done later,
+ when (if) necessary.
+
+ Arrays are a little simpler to handle than records, because the same
+ amount of memory is allocated for each element of the array, even if
+ the amount of space actually used by each element differs from element
+ to element. Consider for instance the following array of type Rec:
type Rec_Array is array (1 .. 2) of Rec;
- The type structure in GDB describes an array in terms of its
- bounds, and the type of its elements. By design, all elements
- in the array have the same type. So we cannot use a fixed type
- for the array elements in this case, since the fixed type depends
- on the actual value of each element.
-
- Fortunately, what happens in practice is that each element of
- the array has the same size, which is the maximum size that
- might be needed in order to hold an object of the element type.
- And the compiler shows it in the debugging information by wrapping
- the array element inside a private PAD type. This type should not
- be shown to the user, and must be "unwrap"'ed before printing. Note
+ The actual amount of memory occupied by each element might be different
+ from element to element, depending on the value of their discriminant.
+ But the amount of space reserved for each element in the array remains
+ fixed regardless. So we simply need to compute that size using
+ the debugging information available, from which we can then determine
+ the array size (we multiply the number of elements of the array by
+ the size of each element).
+
+ The simplest case is when we have an array of a constrained element
+ type. For instance, consider the following type declarations:
+
+ type Bounded_String (Max_Size : Integer) is
+ Length : Integer;
+ Buffer : String (1 .. Max_Size);
+ end record;
+ type Bounded_String_Array is array (1 ..2) of Bounded_String (80);
+
+ In this case, the compiler describes the array as an array of
+ variable-size elements (identified by its XVS suffix) for which
+ the size can be read in the parallel XVZ variable.
+
+ In the case of an array of an unconstrained element type, the compiler
+ wraps the array element inside a private PAD type. This type should not
+ be shown to the user, and must be "unwrap"'ed before printing. Note
that we also use the adjective "aligner" in our code to designate
these wrapper types.
- These wrapper types should have a constant size, which is the size
- of each element of the array. In the case when the size is statically
- known, the PAD type will already have the right size, and the array
- element type should remain unfixed. But there are cases when
- this size is not statically known. For instance, assuming that
- "Five" is an integer variable:
+ In some cases, the size allocated for each element is statically
+ known. In that case, the PAD type already has the correct size,
+ and the array element should remain unfixed.
+
+ But there are cases when this size is not statically known.
+ For instance, assuming that "Five" is an integer variable:
type Dynamic is array (1 .. Five) of Integer;
type Wrapper (Has_Length : Boolean := False) is record
In that case, a copy of the PAD type with the correct size should
be used for the fixed array.
- However, things are slightly different in the case of dynamic
+ 3. ``Fixing'' record type objects:
+ ----------------------------------
+
+ Things are slightly different from arrays in the case of dynamic
record types. In this case, in order to compute the associated
fixed type, we need to determine the size and offset of each of
its components. This, in turn, requires us to compute the fixed
In that case, the position of field "Length" depends on the size
of field Str, which itself depends on the value of the Max_Size
- discriminant. In order to fix the type of variable My_String,
+ discriminant. In order to fix the type of variable My_String,
we need to fix the type of field Str. Therefore, fixing a variant
record requires us to fix each of its components.
The debugger computes the position of each field based on an algorithm
that uses, among other things, the actual position and size of the field
- preceding it. Let's now imagine that the user is trying to print the
- value of My_Container. If the type fixing was recursive, we would
+ preceding it. Let's now imagine that the user is trying to print
+ the value of My_Container. If the type fixing was recursive, we would
end up computing the offset of field After based on the size of the
fixed version of field First. And since in our example First has
only one actual field, the size of the fixed type is actually smaller
than the amount of space allocated to that field, and thus we would
compute the wrong offset of field After.
- Unfortunately, we need to watch out for dynamic components of variant
- records (identified by the ___XVL suffix in the component name).
- Even if the target type is a PAD type, the size of that type might
- not be statically known. So the PAD type needs to be unwrapped and
- the resulting type needs to be fixed. Otherwise, we might end up
- with the wrong size for our component. This can be observed with
- the following type declarations:
+ To make things more complicated, we need to watch out for dynamic
+ components of variant records (identified by the ___XVL suffix in
+ the component name). Even if the target type is a PAD type, the size
+ of that type might not be statically known. So the PAD type needs
+ to be unwrapped and the resulting type needs to be fixed. Otherwise,
+ we might end up with the wrong size for our component. This can be
+ observed with the following type declarations:
type Octal is new Integer range 0 .. 7;
type Octal_Array is array (Positive range <>) of Octal;
In that case, Buffer is a PAD type whose size is unset and needs
to be computed by fixing the unwrapped type.
- Lastly, when should the sub-elements of a type that remained unfixed
+ 4. When to ``Fix'' un-``Fixed'' sub-elements of an entity:
+ ----------------------------------------------------------
+
+ Lastly, when should the sub-elements of an entity that remained unfixed
thus far, be actually fixed?
The answer is: Only when referencing that element. For instance
goto nosideret;
}
- if (ada_is_packed_array_type (desc_base_type (value_type (argvec[0]))))
+ if (ada_is_constrained_packed_array_type
+ (desc_base_type (value_type (argvec[0]))))
argvec[0] = ada_coerce_to_simple_array (argvec[0]);
else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (value_type (argvec[0]), 0) != 0)
TYPE_TARGET_TYPE (value_type (array)) =
ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)));
- if (ada_is_packed_array_type (value_type (array)))
+ if (ada_is_constrained_packed_array_type (value_type (array)))
error (_("cannot slice a packed array"));
/* If this is a reference to an array or an array lvalue,
{
arg1 = ada_coerce_ref (arg1);
- if (ada_is_packed_array_type (value_type (arg1)))
+ if (ada_is_constrained_packed_array_type (value_type (arg1)))
arg1 = ada_coerce_to_simple_array (arg1);
type = ada_index_type (value_type (arg1), tem,
error (_("unexpected attribute encountered"));
case OP_ATR_FIRST:
return value_from_longest
- (range_type, discrete_type_low_bound (range_type));
+ (range_type, ada_discrete_type_low_bound (range_type));
case OP_ATR_LAST:
return value_from_longest
- (range_type, discrete_type_high_bound (range_type));
+ (range_type, ada_discrete_type_high_bound (range_type));
case OP_ATR_LENGTH:
error (_("the 'length attribute applies only to array types"));
}
{
LONGEST low, high;
- if (ada_is_packed_array_type (type_arg))
- type_arg = decode_packed_array_type (type_arg);
+ if (ada_is_constrained_packed_array_type (type_arg))
+ type_arg = decode_constrained_packed_array_type (type_arg);
type = ada_index_type (type_arg, tem, ada_attribute_name (op));
if (type == NULL)
subtype_info = strstr (name, "___XD");
if (subtype_info == NULL)
{
- LONGEST L = discrete_type_low_bound (raw_type);
- LONGEST U = discrete_type_high_bound (raw_type);
+ LONGEST L = ada_discrete_type_low_bound (raw_type);
+ LONGEST U = ada_discrete_type_high_bound (raw_type);
if (L < INT_MIN || U > INT_MAX)
return raw_type;
else
return create_range_type (alloc_type_copy (orig_type), raw_type,
- discrete_type_low_bound (raw_type),
- discrete_type_high_bound (raw_type));
+ ada_discrete_type_low_bound (raw_type),
+ ada_discrete_type_high_bound (raw_type));
}
else
{
ULONGEST
ada_modulus (struct type *type)
{
- ULONGEST modulus;
-
- /* Normally, the modulus of a modular type is equal to the value of
- its upper bound + 1. However, the upper bound is currently stored
- as an int, which is not always big enough to hold the actual bound
- value. To workaround this, try to take advantage of the encoding
- that GNAT uses with with discrete types. To avoid some unnecessary
- parsing, we do this only when the size of TYPE is greater than
- the size of the field holding the bound. */
- if (TYPE_LENGTH (type) > sizeof (TYPE_HIGH_BOUND (type))
- && ada_modulus_from_name (type, &modulus))
- return modulus;
-
- return (ULONGEST) (unsigned int) TYPE_HIGH_BOUND (type) + 1;
+ return (ULONGEST) TYPE_HIGH_BOUND (type) + 1;
}
\f