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

* [Bug python/17568] gdb.lookup_type fails if a C++11 enum class has a value with the same name
  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 ` ssbssa at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: ssbssa at sourceware dot org @ 2023-12-15 20:18 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |7.8
             Status|NEW                         |RESOLVED
                 CC|                            |ssbssa at sourceware dot org
         Resolution|---                         |FIXED

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
Looks to me like this was fixed quite some time ago.

With gdb-7.8 I already get these results:
```
(gdb) pt SP
type = enum class SP : int {SP::SP}
(gdb) p SP
Attempt to use a type name as an expression
(gdb) p SP::SP
$1 = SP::SP
(gdb) py print(gdb.lookup_type('SP'))
SP
(gdb) py print(gdb.parse_and_eval('SP'))
Traceback (most recent call last):
  File "<string>", line 1, in <module>
gdb.error: Attempt to use a type name as an expression
Error while executing Python code.
(gdb) py print(gdb.parse_and_eval('SP::SP'))
SP::SP
```

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