From: Ian Lance Taylor Date: Tue, 2 Feb 1993 23:32:18 +0000 (+0000) Subject: Tue Feb 2 15:30:33 1993 Ian Lance Taylor (ian@cygnus.com) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fee754c921c727d6b124a9a72149fe4b22c5a1dd;p=binutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 40391d8f235..d64807a12a7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/mipsread.c b/gdb/mipsread.c index f61940896cb..accfe231bb1 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -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;