int stride;
struct type *element_type;
- /* If the array itself doesn't provide a stride value then take
- whatever stride the range provides. Don't update BIT_STRIDE as
- we don't want to place the stride value from the range into this
- arrays bit size field. */
- stride = TYPE_FIELD_BITSIZE (type, 0);
- if (stride == 0)
- stride = range_type->bit_stride ();
+ stride = type->bit_stride ();
if (!get_discrete_bounds (range_type, &low_bound, &high_bound))
low_bound = high_bound = 0;
ULONGEST bit_stride () const
{
+ if (this->code () == TYPE_CODE_ARRAY && this->field (0).bitsize != 0)
+ return this->field (0).bitsize;
return this->bounds ()->bit_stride ();
}
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib "ada.exp"
+load_lib "gdb-python.exp"
if { [skip_ada_tests] } { return -1 }
gdb_test "print objects(2 .. 2)" \
[string_to_regexp " = (2 => $v2)"] \
"print second array slice"
+
+ # This is only supported for the DWARF encoding.
+ if {$scenario == "minimal" && ![skip_python_tests]} {
+ gdb_test_no_output \
+ "python o = gdb.parse_and_eval('objects')" \
+ "fetch value for python"
+ gdb_test "python print(o)" \
+ [string_to_regexp "($v1, $v2)"] \
+ "python print array"
+ gdb_test "python print(o\[1\])" \
+ [string_to_regexp "$v1"] \
+ "python print first array element"
+ gdb_test "python print(o\[2\])" \
+ [string_to_regexp "$v2"] \
+ "python print second array element"
+ }
}