public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "b.r.longbons at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/17568] New: gdb.lookup_type fails if a C++11 enum class has a value with the same name
Date: Sun, 09 Nov 2014 07:45:00 -0000	[thread overview]
Message-ID: <bug-17568-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 17568
           Summary: gdb.lookup_type fails if a C++11 enum class has a
                    value with the same name
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: b.r.longbons at gmail dot com

// source, compile with -std=c++0x, requires gcc 4.4 or later
enum class SP { SP };

This bug is most likely related to the fact that gdb does not yet distinguish
between 'enum' and 'enum class', but somehow `ptype` manages to get the right
symbol.



# bad
(gdb) python print gdb.lookup_type('SP')
Traceback (most recent call last):
  File "<string>", line 1, in <module>
gdb.error: No type named SP.
Error while executing Python code.

# bad, SP is a type, SP::SP is the value
(gdb) python print gdb.parse_and_eval('SP')
SP

# bad, but useful to get the thing I'm actually wanting
(gdb) python print gdb.parse_and_eval('SP').type
SP

# mostly good (should be 'enum class')
(gdb) ptype SP
type = enum SP {SP}

# bad, there is no value named 'SP', only 'SP::SP'
(gdb) p SP
$1 = SP

# bad
(gdb) p SP::SP
A syntax error in expression, near `'.

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


             reply	other threads:[~2014-11-09  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-09  7:45 b.r.longbons at gmail dot com [this message]
2023-12-15 20:18 ` [Bug python/17568] " ssbssa at sourceware dot 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-17568-4717@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).