aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1993-02-02 23:32:18 +0000
committerIan Lance Taylor <ian@airs.com>1993-02-02 23:32:18 +0000
commitfee754c921c727d6b124a9a72149fe4b22c5a1dd (patch)
tree072f66ec858cd2af6766342fa6d601eda4efc82b /gdb
parent93928b60e5caaa945fd9d05f8ec8e0692301dbd8 (diff)
downloadgdb-fee754c921c727d6b124a9a72149fe4b22c5a1dd.zip
gdb-fee754c921c727d6b124a9a72149fe4b22c5a1dd.tar.gz
gdb-fee754c921c727d6b124a9a72149fe4b22c5a1dd.tar.bz2
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/mipsread.c33
2 files changed, 15 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 40391d8..d64807a 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 f619408..accfe23 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;