Fix PR gdb/648
	* language.h (enum array_ordering): New enum.
	* language.h (struct language_defn): New la_array_ordering
	attribute.
	* language.c (unknown_language_defn, auto_language_defn)
	(local_language_defn): Ditto.
	* ada-lang.c (ada_language_defn): Ditto.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Ditto.
	* f-lang.c (f_language_defn): Ditto.
	* jv-lang.c (java_language_defn): Ditto.
	* m2-lang.c (f_language_defn): Ditto.
	* objc-lang.c (objc_language_defn): Ditto.
	* p-lang.c (pascal_language_defn): Ditto.
	* scm-lang.c (scm_language_defn): Ditto.
	* eval.c (evaluate_subexp_standard): Assume Fortran arrays are
	oriented large to small in type structure.
	* dwarf2read.c (read_array_order): New function.
	(read_array_type): Use read_array_order to check row/column
	major ordering.
This commit is contained in:
David Lecomber
2004-08-29 10:12:24 +00:00
parent 47e35c11d6
commit 7ca2d3a371
13 changed files with 116 additions and 12 deletions

View File

@@ -848,6 +848,9 @@ static CORE_ADDR decode_locdesc (struct dwarf_block *, struct dwarf2_cu *);
static void read_array_type (struct die_info *, struct dwarf2_cu *);
static enum dwarf_array_dim_ordering read_array_order (struct die_info *,
struct dwarf2_cu *);
static void read_tag_pointer_type (struct die_info *, struct dwarf2_cu *);
static void read_tag_ptr_to_member_type (struct die_info *,
@@ -3724,9 +3727,20 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
/* Dwarf2 dimensions are output from left to right, create the
necessary array types in backwards order. */
type = element_type;
while (ndim-- > 0)
type = create_array_type (NULL, type, range_types[ndim]);
if (read_array_order (die, cu) == DW_ORD_col_major)
{
int i = 0;
while (i < ndim)
type = create_array_type (NULL, type, range_types[i++]);
}
else
{
while (ndim-- > 0)
type = create_array_type (NULL, type, range_types[ndim]);
}
/* Understand Dwarf2 support for vector types (like they occur on
the PowerPC w/ AltiVec). Gcc just adds another attribute to the
@@ -3744,6 +3758,41 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
die->type = type;
}
static enum dwarf_array_dim_ordering
read_array_order (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
attr = dwarf2_attr (die, DW_AT_ordering, cu);
if (attr) return DW_SND (attr);
/*
GNU F77 is a special case, as at 08/2004 array type info is the
opposite order to the dwarf2 specification, but data is still
laid out as per normal fortran.
FIXME: dsl/2004-8-20: If G77 is ever fixed, this will also need
version checking.
*/
if (cu->language == language_fortran &&
cu->producer && strstr (cu->producer, "GNU F77"))
{
return DW_ORD_row_major;
}
switch (cu->language_defn->la_array_ordering)
{
case array_column_major:
return DW_ORD_col_major;
case array_row_major:
default:
return DW_ORD_row_major;
};
}
/* First cut: install each common block member as a global variable. */
static void