This is the mail archive of the 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]

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

On 10/07/2011 02:26 PM, Sterling Augustine wrote:
saugustine@sterling$ g++ -g -o enum-namespace
saugustine@sterling$ gdb ./enum-namespace
GNU gdb (GDB)
(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've tried to reproduce this, but I cannot seem to replicate using your instructions:

$ cat > << EOF
> namespace foo { }
> int main () { return 0; }
$ cat > << EOF
> namespace foo {
> enum B { B_B };
> enum B b = B_B;
> };
$ g++ -g enum0*.cc -o enum; popd
$ ./gdb -v
GNU gdb (GDB)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /home/keiths/tmp/enum...done.
(gdb) p foo::B_B
$1 = foo::B_B

Although this appears to work, your patch looks correct to me. If I inspect the partial die names and the physnames, they do differ (foo::B::B_B vs foo::B_B), and clearly foo::B::B_B is incorrect, since enum B_B is of the unscoped variety.

I would also not expect to see any child dies for DW_TAG_enumerator, so I agree that testing parent_die->tag == DW_TAG_enumerator doesn't make sense.

IMO, I would recommend that a maintainer accept this patch (with a test case).

Aside: If support is added for scoped enumerations, this will need modifying -- the original behavior is correct in that case (but still not for unscoped enums). dwarf2_compute_name will also need fixing. :-)]


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