Re: Make DW_TAG_enumerator's consistent, regardless of containing scope

Sterling Augustine
2011-10-08T00:46:29Z

On Fri, Oct 7, 2011 at 4:42 PM, Keith Seitz <keiths@redhat.com> wrote:
> On 10/07/2011 02:26 PM, Sterling Augustine wrote:
>>
>> 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.
>
> First things first: this is going to need a test case.

I'll write one this weekend.

> I've tried to reproduce this, but I cannot seem to replicate using your
> instructions:
....

> $ g++ -g enum0*.cc -o enum; popd

Try it without the wildcard. The shell can glob enum0.cc before
enum0_main.cc, but the test-case needs enum0_main.cc first on gcc's
command line.

The order matters because when the namespace foo gets looked up in the
partial symbol table, GDB builds the full-symbol table, and the full
symbol table has it right. If gdb finds enum0.cc's copy of the
namespace foo die first, then when it converts that CU's psymtab to a
full symtab, the enum's correct name will be created and you won't see
the problem.

However, if gdb find's enum0_main.cc's namespace foo die first, then
the conversion to the full psymtab won't create one for the enum.

This hints to me--but I'm not sure--that some kind of special handling
for namespace dies would be appropriate, because they can appear in
multiple CU's. But that is beyond the present issue.

This

Sterling