diff options
author | David Lecomber <david@lecomber.net> | 2004-08-29 10:12:24 +0000 |
---|---|---|
committer | David Lecomber <david@lecomber.net> | 2004-08-29 10:12:24 +0000 |
commit | 7ca2d3a37165b1847d70b4436d8b2d62d0d5fba7 (patch) | |
tree | fbe75dec9d20c099a13c1126dc1115ed85a87e49 /gdb/dwarf2read.c | |
parent | 47e35c11d6ece68ddf7069b36f20a6d6fbb7c465 (diff) | |
download | gdb-7ca2d3a37165b1847d70b4436d8b2d62d0d5fba7.zip gdb-7ca2d3a37165b1847d70b4436d8b2d62d0d5fba7.tar.gz gdb-7ca2d3a37165b1847d70b4436d8b2d62d0d5fba7.tar.bz2 |
2004-08-29 David Lecomber <david@streamline-computing.com>
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index fa11475..4e9cdfa 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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 |