This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Make DW_TAG_enumerator's consistent, regardless of containing scope


This patch fixes the issue described in
http://sourceware.org/ml/gdb/2011-09/msg00119.html. To recap, consider
the testcase below. Dividing the namespace definition into two
compilation units and their order on the command-line is essential to
see the problem.

enum0_main.cc:

namespace foo { }

int main() { return 0; }

enum0.cc:

namespace foo {
enum B {  B_B };

enum B b = B_B;
};

saugustine@sterling$ g++ -g enum0_main.cc enum0.cc -o enum-namespace
saugustine@sterling$ gdb ./enum-namespace
GNU gdb (GDB) 7.3.50.20111007-cvs
...
(gdb) p foo::B_B
No symbol "B_B" in namespace "foo".
(gdb) p foo::B::B_B
`foo::B' is not defined as an aggregate type.

GDB puts this definition into the partial symbol table as foo::B::B_B,
but it should be foo::B_B.

After partial symbols have been converted to full symbols, the
enum-type is not be included as part of the enumerator's scope.

The enclosed patch fixes the situation dropping the enum-type name for
all enumerators. The original code was commented that it should do
that, but didn't work because it was looking at the enumerator die's
parent die, rather than the enumerator die itself.

The file split in the test case is required to avoid reading all of
namespace foo's symbols in the intermediate symbol lookup.

OK to commit?

Sterling

2011-10-07  Sterling Augustine  <saugustine@google.com>

	* dwarf2read.c (partial_die_parent_scope): Rearrange conditional logic.

Attachment: enumerator-patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]