This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/17568] New: gdb.lookup_type fails if a C++11 enum class has a value with the same name
- From: "b.r.longbons at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sun, 09 Nov 2014 07:45:54 +0000
- Subject: [Bug python/17568] New: gdb.lookup_type fails if a C++11 enum class has a value with the same name
- Auto-submitted: auto-generated
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.