Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Sterling Augustine <saugustine@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
Date: Fri, 07 Oct 2011 23:43:00 -0000	[thread overview]
Message-ID: <4E8F8E82.8060803@redhat.com> (raw)
In-Reply-To: <CAEG7qUxckuOJJzDza6fHrajeNyr9bdd-jT22oQL85Dh0p-BN5w@mail.gmail.com>

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've tried to reproduce this, but I cannot seem to replicate using your 
instructions:

$ cat > enum0_main.cc << EOF
 > namespace foo { }
 > int main () { return 0; }
 > EOF
$ cat > enum0.cc << EOF
 > namespace foo {
 >   enum B {  B_B };
 >   enum B b = B_B;
 > };
 > EOF
$ g++ -g enum0*.cc -o enum; popd
$ ./gdb -v
GNU gdb (GDB) 7.3.50.20111005-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
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. :-)]

Keith


  reply	other threads:[~2011-10-07 23:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 21:27 Sterling Augustine
2011-10-07 23:43 ` Keith Seitz [this message]
2011-10-08  0:46   ` Sterling Augustine
2011-10-10 22:21 ` Sterling Augustine
2011-10-11 17:07   ` Tom Tromey
2011-10-11 18:27     ` Sterling Augustine
2011-10-11 19:04       ` Tom Tromey
2011-10-12  9:21       ` [obv] Fix gdb.cp/namespace-enum.exp compilation [Re: Make DW_TAG_enumerator's consistent, regardless of containing scope] Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E8F8E82.8060803@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=saugustine@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox