PR gdb/11702

* dwarf2read.c (dwarf2_add_field): Only create a symbol if
	DW_AT_external is present.
This commit is contained in:
Doug Evans 2010-06-30 05:39:23 +00:00
parent 039ba22f21
commit 3863f96c20
2 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,9 @@
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,

View File

@ -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);
}