* dwarf2read.c (dwarf2_add_field): Only create a symbol if
DW_AT_external is present.
2010-06-29 Doug Evans <dje@google.com>
PR gdb/11702
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.
* 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.
- /* 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. */
if (die->tag == DW_TAG_member && ! die_is_declaration (die, cu))
{
/* Data member other than a C++ static data member. */
return;
attr = dwarf2_attr (die, DW_AT_const_value, cu);
return;
attr = dwarf2_attr (die, DW_AT_const_value, cu);
+ 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. */
{
/* A static const member, not much different than an enum as far as
we're concerned, except that we can support more types. */
static const members. */
if (die->tag == DW_TAG_member)
{
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);
}
gdb_assert (die_is_declaration (die, cu));
gdb_assert (attr);
}