diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-04-26 20:32:30 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-04-26 20:32:30 +0000 |
commit | 4fae6e18a2b887cc90c64d9909c94ad3b05b2ade (patch) | |
tree | 7407268d3e65b6591f8bd7ed3c981c8bd7889d7f /gdb | |
parent | 14132e8924cd988218b4b2c4c6aaea45af951c59 (diff) | |
download | gdb-4fae6e18a2b887cc90c64d9909c94ad3b05b2ade.zip gdb-4fae6e18a2b887cc90c64d9909c94ad3b05b2ade.tar.gz gdb-4fae6e18a2b887cc90c64d9909c94ad3b05b2ade.tar.bz2 |
gdb/
Fix DW_AT_lower_bound defaults for DWARF-4+.
* dwarf2read.c (read_subrange_type): Remove initialization of low and
high. New variable low_default_is_valid. Implement DWARF-4+
DW_AT_lower_bound defaults. Print complaint for DW_AT_lower_bound with
no default by the DWARF standard.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 39 |
2 files changed, 42 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 05073a1..31b207f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2012-04-26 Jan Kratochvil <jan.kratochvil@redhat.com> + + Fix DW_AT_lower_bound defaults for DWARF-4+. + * dwarf2read.c (read_subrange_type): Remove initialization of low and + high. New variable low_default_is_valid. Implement DWARF-4+ + DW_AT_lower_bound defaults. Print complaint for DW_AT_lower_bound with + no default by the DWARF standard. + 2012-04-26 Maciej W. Rozycki <macro@mips.com> Maciej W. Rozycki <macro@codesourcery.com> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index bd2d6f2..99bba9f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9086,8 +9086,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; - LONGEST low = 0; - LONGEST high = -1; + LONGEST low, high; + int low_default_is_valid; char *name; LONGEST negative_mask; @@ -9100,10 +9100,35 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) if (range_type) return range_type; - if (cu->language == language_fortran) + /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow + omitting DW_AT_lower_bound. */ + switch (cu->language) { - /* FORTRAN implies a lower bound of 1, if not given. */ + case language_c: + case language_cplus: + low = 0; + low_default_is_valid = 1; + break; + case language_fortran: + low = 1; + low_default_is_valid = 1; + break; + case language_d: + case language_java: + case language_objc: + low = 0; + low_default_is_valid = (cu->header.version >= 4); + break; + case language_ada: + case language_m2: + case language_pascal: low = 1; + low_default_is_valid = (cu->header.version >= 4); + break; + default: + low = 0; + low_default_is_valid = 0; + break; } /* FIXME: For variable sized arrays either of these could be @@ -9111,7 +9136,11 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) but we don't know how to handle it. */ attr = dwarf2_attr (die, DW_AT_lower_bound, cu); if (attr) - low = dwarf2_get_attr_constant_value (attr, 0); + low = dwarf2_get_attr_constant_value (attr, low); + else if (!low_default_is_valid) + complaint (&symfile_complaints, _("Missing DW_AT_lower_bound " + "- DIE at 0x%x [in module %s]"), + die->offset.sect_off, cu->objfile->name); attr = dwarf2_attr (die, DW_AT_upper_bound, cu); if (attr) |