* gdbtypes.c (create_range_type): If indextype has TYPE_FLAG_STUB
set, set TYPE_FLAG_TARGET_STUB. (check_stub_type): Recalculate TYPE_LENGTH for range type. * stabsread.c (read_range_type): If index type number is followed by '=', back up, call read_type. and assume we have a true range. * gdbtypes.h (TYPE_FLAG_TARGET_STUB): Update comment. This fixes PR 6632.
This commit is contained in:
parent
7d777b91ad
commit
e55a579687
4 changed files with 39 additions and 10 deletions
|
@ -1,3 +1,12 @@
|
|||
Tue Mar 28 17:04:04 1995 Per Bothner <bothner@kalessin.cygnus.com>
|
||||
|
||||
* gdbtypes.c (create_range_type): If indextype has TYPE_FLAG_STUB
|
||||
set, set TYPE_FLAG_TARGET_STUB.
|
||||
(check_stub_type): Recalculate TYPE_LENGTH for range type.
|
||||
* stabsread.c (read_range_type): If index type number is followed
|
||||
by '=', back up, call read_type. and assume we have a true range.
|
||||
* gdbtypes.h (TYPE_FLAG_TARGET_STUB): Update comment.
|
||||
|
||||
Mon Mar 27 22:51:54 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
||||
|
||||
* alpha-nat.c, irix4-nat.c, irix5-nat.c, mipsv4-nat.c,
|
||||
|
|
|
@ -320,6 +320,9 @@ create_range_type (result_type, index_type, low_bound, high_bound)
|
|||
}
|
||||
TYPE_CODE (result_type) = TYPE_CODE_RANGE;
|
||||
TYPE_TARGET_TYPE (result_type) = index_type;
|
||||
if (TYPE_FLAGS (index_type) & TYPE_FLAG_STUB)
|
||||
TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
|
||||
else
|
||||
TYPE_LENGTH (result_type) = TYPE_LENGTH (index_type);
|
||||
TYPE_NFIELDS (result_type) = 2;
|
||||
TYPE_FIELDS (result_type) = (struct field *)
|
||||
|
@ -890,8 +893,9 @@ check_stub_type (type)
|
|||
struct type *range_type;
|
||||
|
||||
check_stub_type (TYPE_TARGET_TYPE (type));
|
||||
if (!(TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_STUB)
|
||||
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
|
||||
if (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_STUB)
|
||||
{ }
|
||||
else if (TYPE_CODE (type) == TYPE_CODE_ARRAY
|
||||
&& TYPE_NFIELDS (type) == 1
|
||||
&& (TYPE_CODE (range_type = TYPE_FIELD_TYPE (type, 0))
|
||||
== TYPE_CODE_RANGE))
|
||||
|
@ -905,6 +909,11 @@ check_stub_type (type)
|
|||
* TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
|
||||
TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
|
||||
}
|
||||
else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
|
||||
{
|
||||
TYPE_LENGTH (type) = TYPE_LENGTH (TYPE_TARGET_TYPE (type));
|
||||
TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,8 +146,8 @@ enum type_code
|
|||
|
||||
/* The target type of this type is a stub type, and this type needs to
|
||||
be updated if it gets un-stubbed in check_stub_type. Currently only
|
||||
used for arrays, in which TYPE_LENGTH of the array gets set based
|
||||
on the TYPE_LENGTH of the target type. */
|
||||
used for arrays and ranges, in which TYPE_LENGTH of the array/range
|
||||
gets set based on the TYPE_LENGTH of the target type. */
|
||||
|
||||
#define TYPE_FLAG_TARGET_STUB (1 << 3)
|
||||
|
||||
|
|
|
@ -3373,12 +3373,13 @@ read_range_type (pp, typenums, objfile)
|
|||
int typenums[2];
|
||||
struct objfile *objfile;
|
||||
{
|
||||
char *orig_pp = *pp;
|
||||
int rangenums[2];
|
||||
long n2, n3;
|
||||
int n2bits, n3bits;
|
||||
int self_subrange;
|
||||
struct type *result_type;
|
||||
struct type *index_type;
|
||||
struct type *index_type = NULL;
|
||||
|
||||
/* First comes a type we are a subrange of.
|
||||
In C it is usually 0, 1 or the type being defined. */
|
||||
|
@ -3389,6 +3390,12 @@ read_range_type (pp, typenums, objfile)
|
|||
self_subrange = (rangenums[0] == typenums[0] &&
|
||||
rangenums[1] == typenums[1]);
|
||||
|
||||
if (**pp == '=')
|
||||
{
|
||||
*pp = orig_pp;
|
||||
index_type = read_type (pp, objfile);
|
||||
}
|
||||
|
||||
/* A semicolon should now follow; skip it. */
|
||||
if (**pp == ';')
|
||||
(*pp)++;
|
||||
|
@ -3401,6 +3408,9 @@ read_range_type (pp, typenums, objfile)
|
|||
if (n2bits == -1 || n3bits == -1)
|
||||
return error_type (pp);
|
||||
|
||||
if (index_type)
|
||||
goto handle_true_range;
|
||||
|
||||
/* If limits are huge, must be large integral type. */
|
||||
if (n2bits != 0 || n3bits != 0)
|
||||
{
|
||||
|
@ -3508,6 +3518,7 @@ read_range_type (pp, typenums, objfile)
|
|||
|
||||
/* We have a real range type on our hands. Allocate space and
|
||||
return a real pointer. */
|
||||
handle_true_range:
|
||||
|
||||
/* At this point I don't have the faintest idea how to deal with
|
||||
a self_subrange type; I'm going to assume that this is used
|
||||
|
|
Loading…
Reference in a new issue