diff options
author | Doug Evans <dje@google.com> | 2010-06-30 05:39:23 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2010-06-30 05:39:23 +0000 |
commit | 3863f96c205610e5351a0484cc9d45f9779365bf (patch) | |
tree | 7727d5c517d69217ddd9077ca74bb858877f45b4 | |
parent | 039ba22f21e1a219428941070089dc9d62dabf30 (diff) | |
download | gdb-3863f96c205610e5351a0484cc9d45f9779365bf.zip gdb-3863f96c205610e5351a0484cc9d45f9779365bf.tar.gz gdb-3863f96c205610e5351a0484cc9d45f9779365bf.tar.bz2 |
PR gdb/11702
* dwarf2read.c (dwarf2_add_field): Only create a symbol if
DW_AT_external is present.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 18 |
2 files changed, 12 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 07f2bf4..b3f6fc5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,10 @@ 2010-06-29 Doug Evans <dje@google.com> PR gdb/11702 + * dwarf2read.c (dwarf2_add_field): Only create a symbol if + DW_AT_external is present. + + PR gdb/11702 * NEWS: Add entry. * dwarf2read.c (dwarf2_add_field): If DW_AT_const_value is present, create a symbol for the field and record the value. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 127d10f..858b18e 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4528,11 +4528,6 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, fp = &new_field->field; - /* NOTE: According to the dwarf standard, static data members are - indicated by having DW_AT_external. - The check here for ! die_is_declaration is historical. - This test is replicated in new_symbol. */ - if (die->tag == DW_TAG_member && ! die_is_declaration (die, cu)) { /* Data member other than a C++ static data member. */ @@ -4649,7 +4644,12 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, return; attr = dwarf2_attr (die, DW_AT_const_value, cu); - if (attr) + if (attr + /* Only create a symbol if this is an external value. + new_symbol checks this and puts the value in the global symbol + table, which we want. If it is not external, new_symbol + will try to put the value in cu->list_in_scope which is wrong. */ + && dwarf2_flag_true_p (die, DW_AT_external, cu)) { /* A static const member, not much different than an enum as far as we're concerned, except that we can support more types. */ @@ -8850,10 +8850,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) static const members. */ if (die->tag == DW_TAG_member) { - /* NOTE: This test seems wrong according to the dwarf standard. - static data members are represented by DW_AT_external. - However, dwarf2_add_field is currently calling - die_is_declaration to check, so we do the same. */ + /* dwarf2_add_field uses die_is_declaration, + so we do the same. */ gdb_assert (die_is_declaration (die, cu)); gdb_assert (attr); } |