Change regcache list to be an hash map
[deliverable/binutils-gdb.git] / gdb / valarith.c
index ea999b5ba71a3a876e2f44f75f95b55225094b83..887acc86751078ad3f5944b2b6119d414edccd29 100644 (file)
@@ -188,6 +188,17 @@ value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST lowerbound
   struct type *array_type = check_typedef (value_type (array));
   struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
   ULONGEST elt_size = type_length_units (elt_type);
+
+  /* Fetch the bit stride and convert it to a byte stride, assuming 8 bits
+     in a byte.  */
+  LONGEST stride = TYPE_ARRAY_BIT_STRIDE (array_type);
+  if (stride != 0)
+    {
+      struct gdbarch *arch = get_type_arch (elt_type);
+      int unit_size = gdbarch_addressable_memory_unit_size (arch);
+      elt_size = stride / (unit_size * 8);
+    }
+
   ULONGEST elt_offs = elt_size * (index - lowerbound);
 
   if (index < lowerbound
@@ -1712,7 +1723,7 @@ value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
   word = extract_unsigned_integer (valaddr + (rel_index / TARGET_CHAR_BIT), 1,
                                   type_byte_order (type));
   rel_index %= TARGET_CHAR_BIT;
-  if (gdbarch_bits_big_endian (gdbarch))
+  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
     rel_index = TARGET_CHAR_BIT - 1 - rel_index;
   return (word >> rel_index) & 1;
 }
This page took 0.023907 seconds and 4 git commands to generate.