public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/17568] New: gdb.lookup_type fails if a C++11 enum class has a value with the same name
@ 2014-11-09  7:45 b.r.longbons at gmail dot com
  2023-12-15 20:18 ` [Bug python/17568] " ssbssa at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: b.r.longbons at gmail dot com @ 2014-11-09  7:45 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-15 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-09  7:45 [Bug python/17568] New: gdb.lookup_type fails if a C++11 enum class has a value with the same name b.r.longbons at gmail dot com
2023-12-15 20:18 ` [Bug python/17568] " ssbssa at sourceware dot org

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).