mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
Fix bug in Ada packed array handling
A user found a bug where an array of packed arrays was printed incorrectly. The bug here is that the packed array has a bit stride, but the outer array does not -- and should not. However, update_static_array_size does not distinguish between an array of packed arrays and a multi-dimensional packed array, and for the latter, only the innermost array will end up with a stride. This patch fixes the problem by adding a flag to indicate whether a given array type is a constituent of a multi-dimensional array.
This commit is contained in:
@@ -927,6 +927,15 @@ struct main_type
|
||||
|
||||
unsigned int m_flag_flag_enum : 1;
|
||||
|
||||
/* * For TYPE_CODE_ARRAY, this is true if this type is part of a
|
||||
multi-dimensional array. Multi-dimensional arrays are
|
||||
represented internally as arrays of arrays, and this flag lets
|
||||
gdb distinguish between multiple dimensions and an ordinary array
|
||||
of arrays. The flag is set on each inner dimension, but not the
|
||||
outermost dimension. */
|
||||
|
||||
unsigned int m_multi_dimensional : 1;
|
||||
|
||||
/* * A discriminant telling us which field of the type_specific
|
||||
union is being used for this type, if any. */
|
||||
|
||||
@@ -1350,6 +1359,18 @@ struct type
|
||||
this->main_type->m_flag_flag_enum = is_flag_enum;
|
||||
}
|
||||
|
||||
/* True if this array type is part of a multi-dimensional array. */
|
||||
|
||||
bool is_multi_dimensional () const
|
||||
{
|
||||
return this->main_type->m_multi_dimensional;
|
||||
}
|
||||
|
||||
void set_is_multi_dimensional (bool value)
|
||||
{
|
||||
this->main_type->m_multi_dimensional = value;
|
||||
}
|
||||
|
||||
/* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
|
||||
to this type's fixed_point_info. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user