Tue Feb 2 15:30:33 1993 Ian Lance Taylor (ian@cygnus.com)

* mipsread.c (upgrade_type): Build array types correctly, using
	create_range_type and create_array_type.
This commit is contained in:
Ian Lance Taylor 1993-02-02 23:32:18 +00:00
parent 93928b60e5
commit fee754c921
2 changed files with 15 additions and 23 deletions

View File

@ -1,3 +1,8 @@
Tue Feb 2 15:30:33 1993 Ian Lance Taylor (ian@cygnus.com)
* mipsread.c (upgrade_type): Build array types correctly, using
create_range_type and create_array_type.
Tue Feb 2 00:19:08 1993 John Gilmore (gnu@cygnus.com)
* infrun.c (wait_for_inferior): When rolling back the PC after

View File

@ -1536,7 +1536,8 @@ upgrade_type(tpp, tq, ax, bigend)
/* Used in array processing */
int rf, id;
FDR *fh;
struct field *f;
struct type *range;
struct type *indx;
int lower, upper;
RNDXR rndx;
@ -1552,12 +1553,7 @@ upgrade_type(tpp, tq, ax, bigend)
return 0;
case tqArray:
/* We should probably try to use create_range_type and
create_array_type here. FIXME! */
off = 0;
t = init_type(TYPE_CODE_ARRAY, 0, 0, (char *) NULL,
(struct objfile *) NULL);
TYPE_TARGET_TYPE(t) = *tpp;
/* Determine and record the domain type (type of index) */
ecoff_swap_rndx_in (bigend, ax, &rndx);
@ -1570,22 +1566,10 @@ upgrade_type(tpp, tq, ax, bigend)
}
fh = get_rfd(cur_fd, rf);
/* Fields are kept in an array */
/* FIXME - Memory leak! */
if (TYPE_NFIELDS(t))
TYPE_FIELDS(t) = (struct field*)
xrealloc((PTR) TYPE_FIELDS(t),
(TYPE_NFIELDS(t)+1) * sizeof(struct field));
else
TYPE_FIELDS(t) = (struct field*)
xzalloc(sizeof(struct field));
f = &(TYPE_FIELD(t,TYPE_NFIELDS(t)));
TYPE_NFIELDS(t)++;
memset((PTR)f, 0, sizeof(struct field));
/* XXX */ f->type = parse_type(id + (union aux_ext *)fh->iauxBase,
&f->bitsize, bigend);
indx = parse_type (id + (union aux_ext *) fh->iauxBase,
(int *) NULL, bigend);
/* Get the bounds, and create the array type. */
ax++;
lower = AUX_GET_DNLOW (bigend, ax);
ax++;
@ -1593,6 +1577,11 @@ upgrade_type(tpp, tq, ax, bigend)
ax++;
rf = AUX_GET_WIDTH (bigend, ax); /* bit size of array element */
range = create_range_type ((struct type *) NULL, indx,
lower, upper);
t = create_array_type ((struct type *) NULL, *tpp, range);
/* Check whether supplied array element bit size matches
the known size of the element type. If this complaint
ends up not happening, we can remove this code. It's
@ -1607,8 +1596,6 @@ upgrade_type(tpp, tq, ax, bigend)
if (id != rf)
complain (&array_bitsize_complaint, rf);
TYPE_LENGTH(t) = (upper < 0) ? 0 :
(upper - lower + 1) * (rf >> 3);
*tpp = t;
return 4 + off;