diff options
author | Jim Blandy <jimb@codesourcery.com> | 2007-12-17 18:38:30 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2007-12-17 18:38:30 +0000 |
commit | c6a0999f0fcb83bda7db3c75a1970b5cfd82c6dd (patch) | |
tree | 81677d3dacddbba14fe502c4224aaad6865837c2 /gdb | |
parent | 9544c605b634aa6fd72e24537c327dcce5f3a306 (diff) | |
download | gdb-c6a0999f0fcb83bda7db3c75a1970b5cfd82c6dd.zip gdb-c6a0999f0fcb83bda7db3c75a1970b5cfd82c6dd.tar.gz gdb-c6a0999f0fcb83bda7db3c75a1970b5cfd82c6dd.tar.bz2 |
* dwarf2read.c (dwarf2_add_field): Correctly scale all byte
offsets obtained from DW_AT_data_member_location before recording
them in FIELD_BITPOS (*fp).
* dwarf2read.c (attr_form_is_section_offset): Doc fixes.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 22 |
2 files changed, 23 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b5ba6da..6d56bbc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2007-12-17 Jim Blandy <jimb@codesourcery.com> + + * dwarf2read.c (dwarf2_add_field): Correctly scale all byte + offsets obtained from DW_AT_data_member_location before recording + them in FIELD_BITPOS (*fp). + + * dwarf2read.c (attr_form_is_section_offset): Doc fixes. + 2007-12-17 Nigel Stephens <nigel@mips.com> Maciej W. Rozycki <macro@mips.com> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 542fe34..e32e067 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3478,16 +3478,19 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, attr = dwarf2_attr (die, DW_AT_data_member_location, cu); if (attr) { + int byte_offset; + if (attr_form_is_section_offset (attr)) { dwarf2_complex_location_expr_complaint (); - FIELD_BITPOS (*fp) = 0; + byte_offset = 0; } else if (attr_form_is_constant (attr)) - FIELD_BITPOS (*fp) = dwarf2_get_attr_constant_value (attr, 0); + byte_offset = dwarf2_get_attr_constant_value (attr, 0); else - FIELD_BITPOS (*fp) = - decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte; + byte_offset = decode_locdesc (DW_BLOCK (attr), cu); + + FIELD_BITPOS (*fp) = byte_offset * bits_per_byte; } else FIELD_BITPOS (*fp) = 0; @@ -9734,9 +9737,14 @@ attr_form_is_block (struct attribute *attr) || attr->form == DW_FORM_block); } -/* Return non-zero if ATTR's value is a section offset (classes - lineptr, loclistptr, macptr or rangelistptr). In this case, - you may use DW_UNSND (attr) to retrieve the offset. */ +/* Return non-zero if ATTR's value is a section offset --- classes + lineptr, loclistptr, macptr or rangelistptr --- or zero, otherwise. + You may use DW_UNSND (attr) to retrieve such offsets. + + Section 7.5.4, "Attribute Encodings", explains that no attribute + may have a value that belongs to more than one of these classes; it + would be ambiguous if we did, because we use the same forms for all + of them. */ static int attr_form_is_section_offset (struct attribute *attr) { |