public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "keiths at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/16253] Cannot print an enum var with the same name as tag
Date: Wed, 27 Nov 2013 18:52:00 -0000	[thread overview]
Message-ID: <bug-16253-4717-XVbqObSfe9@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16253-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=16253

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com
           Assignee|unassigned at sourceware dot org   |keiths at redhat dot com

--- Comment #2 from Keith Seitz <keiths at redhat dot com> ---
This is happening because of the function symbol_matches_domain, which was
introduced by:

commit 5eeb2539423ce5e7241bce403f48b8babb3670b0
Author: Aleksandar Ristovski <aristovski@qnx.com>
Date:   Mon May 5 14:37:32 2008 +0000

        * ada-lang.c: Update throughout to use symbol_matches_domain
        instead of matching the symbol domain explictly.
        * dwarf2read.c (add_partial_symbol): Do not add new psym for
        STRUCT_DOMAIN. Make sure you recognize c++ struct and java and ada
        class as typedefs. See lookup_partial_symbol function.
        (new_symbol): Similar to add_partial_symbol, do not create
        symbol for the typedef. See lookup_block_symbol.
        * symtab.c (symbol_matches_domain): New function, takes care
        of dual meaning of STRUCT_DOMAIN symbol for c++, ada and java.
        (lookup_partial_symbol): Use symbol_matches_domain to see if the
        found psym domain matches the given domain.
        (lookup_block_symbol): Likewise.

The parsers all lookup names from the input using searches in VAR_DOMAIN.
However, because of the above patch, any symbol in STRUCT_DOMAIN will also
match. As a result, lookup_block_symbol returns the type named "e" instead of
the variable named "e".

>From the comments in this patch (there is no public discussion that I could
find), I believe I understand why it was introduced, but I don't think this
solution was appropriate. I would have thought it would be easier (and more
correct) to either add an explicit typedef during symbol reading or search
VAR_DOMAIN and STRUCT_DOMAIN where appropriate. The only real solution is the
later, since the former will cause name collisions in VAR_DOMAIN.

As it is, I do not think this non-determinant behavior is correct. This will
randomly "hide" variables and types of the same name (depending on where they
are in the symbol table).

There are 183 places where VAR_DOMAIN is mentioned in the source. All need to
be checked. This may take a fair amount of time. If you despearately need a
workaround for c/c++/java (all DWARF), I can send you the work-in-progress
patch for c/c++/java (no test suite regressions). Send me a private email.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2013-11-27 18:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 14:24 [Bug gdb/16253] New: " polacek at redhat dot com
2013-11-26 14:27 ` [Bug gdb/16253] " polacek at redhat dot com
2013-11-27 18:52 ` keiths at redhat dot com [this message]
2013-11-27 23:48 ` polacek at redhat dot com
2014-03-21 18:14 ` [Bug c++/16253] " keiths at redhat dot com
2014-04-14 22:56 ` cvs-commit at gcc dot gnu.org
2014-04-14 22:57 ` keiths at redhat dot com
2014-05-28  1:51 ` dje at google dot com
2014-05-28  1:54 ` dje at google dot com
2014-05-28 17:25 ` dje at google dot com
2014-06-04  3:32 ` xdje42 at gmail dot com
2014-08-29 13:37 ` lgustavo at codesourcery dot com
2015-06-03 15:36 ` fche at redhat dot com
2015-06-03 16:06 ` jason at redhat dot com
2015-06-03 16:09 ` jason at redhat dot com
2015-06-03 16:10 ` jason at redhat dot com
2015-06-03 16:15 ` dje at google dot com
2015-06-03 16:19 ` mgretton at sourceware dot org
2015-06-03 17:32 ` dje at google dot com
2015-06-04 16:01 ` fweimer at redhat dot com
2015-06-04 17:29 ` dje at google dot com
2015-06-12 15:53 ` keiths at redhat dot com
2015-06-26 18:43 ` cvs-commit at gcc dot gnu.org

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=bug-16253-4717-XVbqObSfe9@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).