diff options
author | Doug Evans <dje@google.com> | 2010-06-29 16:53:10 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2010-06-29 16:53:10 +0000 |
commit | 254e6b9ed4abf109cb8399aa3f8f387f7eb2465c (patch) | |
tree | 2bc97c84786aa776590c3ff3c28dedb572e1d449 /gdb/dwarf2read.c | |
parent | 6e70227d64c310278ef73303b2137a9997cb4c0f (diff) | |
download | binutils-254e6b9ed4abf109cb8399aa3f8f387f7eb2465c.zip binutils-254e6b9ed4abf109cb8399aa3f8f387f7eb2465c.tar.gz binutils-254e6b9ed4abf109cb8399aa3f8f387f7eb2465c.tar.bz2 |
PR c++/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.
(new_symbol): Handle DW_TAG_member.
* gdbtypes.c (field_is_static): Remove FIXME.
* symtab.c (search_symbols): When searching for VARIABLES_DOMAIN,
only ignore LOC_CONST symbols that are enums.
testsuite/
Test PR c++/11702.
* gdb.cp/m-static.exp: Add testcase.
* gdb.cp/m-static.h (gnu_obj_4): Add initialized static const member.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index c172752..127d10f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4528,6 +4528,11 @@ 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. */ @@ -4643,6 +4648,14 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, if (fieldname == NULL) return; + attr = dwarf2_attr (die, DW_AT_const_value, cu); + if (attr) + { + /* A static const member, not much different than an enum as far as + we're concerned, except that we can support more types. */ + new_symbol (die, NULL, cu); + } + /* Get physical name. */ physname = (char *) dwarf2_physname (fieldname, die, cu); @@ -8824,6 +8837,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) BLOCK_FUNCTION from the blockvector. */ break; case DW_TAG_variable: + case DW_TAG_member: /* Compilation with minimal debug info may result in variables with missing type entries. Change the misleading `void' type to something sensible. */ @@ -8832,6 +8846,17 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) = objfile_type (objfile)->nodebug_data_symbol; attr = dwarf2_attr (die, DW_AT_const_value, cu); + /* In the case of DW_TAG_member, we should only be called for + 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. */ + gdb_assert (die_is_declaration (die, cu)); + gdb_assert (attr); + } if (attr) { dwarf2_const_value (attr, sym, cu); |