diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-03-08 17:54:44 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-03-08 17:54:44 +0000 |
commit | 421d5c74b4d65edd0a3963db1352c01a230e6bcd (patch) | |
tree | 471d9b19758c04f120f7a096bee73974b53833ad /gdb/dwarf2read.c | |
parent | 63154eca7b36effea83973fe140981e5b7f83428 (diff) | |
download | gdb-421d5c74b4d65edd0a3963db1352c01a230e6bcd.zip gdb-421d5c74b4d65edd0a3963db1352c01a230e6bcd.tar.gz gdb-421d5c74b4d65edd0a3963db1352c01a230e6bcd.tar.bz2 |
gdb/
Fix DWARF-3+ DW_AT_accessibility default assumption.
* dwarf2read.c (dwarf2_add_field): Fix new_field->accessibility for
cu->header.version >= 3.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2a47c7d..ba5680f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6238,13 +6238,25 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, } fip->nfields++; - /* Handle accessibility and virtuality of field. - The default accessibility for members is public, the default - accessibility for inheritance is private. */ - if (die->tag != DW_TAG_inheritance) - new_field->accessibility = DW_ACCESS_public; + if (cu->header.version < 3) + { + /* The default DWARF 2 accessibility for members is public, the default + accessibility for inheritance is private. */ + + if (die->tag != DW_TAG_inheritance) + new_field->accessibility = DW_ACCESS_public; + else + new_field->accessibility = DW_ACCESS_private; + } else - new_field->accessibility = DW_ACCESS_private; + { + /* DWARF 3 specifies the default accessibility explicitly. */ + + if (die->parent->tag == DW_TAG_class_type) + new_field->accessibility = DW_ACCESS_private; + else + new_field->accessibility = DW_ACCESS_public; + } new_field->virtuality = DW_VIRTUALITY_none; attr = dwarf2_attr (die, DW_AT_accessibility, cu); |