summaryrefslogtreecommitdiffstats
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorWilfried Moser <moser@cygnus>1996-01-29 08:17:22 +0000
committerWilfried Moser <moser@cygnus>1996-01-29 08:17:22 +0000
commitd221b17e83dc8562129b8e9284021baa89e3c877 (patch)
treeebac50e4ff99151cfef40b713f18ccc080123db1 /gdb/gdbtypes.c
parentd59558827ed8da7fd4cf379a5bb25f3a2fca3091 (diff)
downloadppe42-binutils-d221b17e83dc8562129b8e9284021baa89e3c877.tar.gz
ppe42-binutils-d221b17e83dc8562129b8e9284021baa89e3c877.zip
* ch-valprint.c (calculate_array_length): New function to determine
the length of an array type (see comment). (chill_val_print (case TYPE_CODE_ARRAY)): If the length of an array type is zero, call calculate_array_length. * gdbtypes.c (get_discrete_bounds (case TYPE_CODE_ENUM)): They values may not be sorted. Scan all entries and set the real lower and
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index a21f9598c0..13a111f088 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -356,8 +356,18 @@ get_discrete_bounds (type, lowp, highp)
case TYPE_CODE_ENUM:
if (TYPE_NFIELDS (type) > 0)
{
- *lowp = TYPE_FIELD_BITPOS (type, 0);
- *highp = TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1);
+ /* The enums may not be sorted by value, so search all
+ entries */
+ int i;
+
+ *lowp = *highp = TYPE_FIELD_BITPOS (type, 0);
+ for (i = 0; i < TYPE_NFIELDS (type); i++)
+ {
+ if (TYPE_FIELD_BITPOS (type, i) < *lowp)
+ *lowp = TYPE_FIELD_BITPOS (type, i);
+ if (TYPE_FIELD_BITPOS (type, i) > *highp)
+ *highp = TYPE_FIELD_BITPOS (type, i);
+ }
}
else
{
OpenPOWER on IntegriCloud