From: Doug Evans Date: Wed, 30 Jun 2010 05:39:23 +0000 (+0000) Subject: PR gdb/11702 X-Git-Tag: gdb_7_2-2010-07-07-branchpoint~85 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3863f96c205610e5351a0484cc9d45f9779365bf;p=external%2Fbinutils.git PR gdb/11702 * dwarf2read.c (dwarf2_add_field): Only create a symbol if DW_AT_external is present. --- 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 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); }