public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/28647] New: Python pretty-printer doesn't work with std::variant containing local type
@ 2021-12-04  1:53 bugmenot at mailinator dot com
  2021-12-04 20:27 ` [Bug python/28647] " ssbssa at sourceware dot org
  2022-01-05 16:26 ` ssbssa at sourceware dot org
  0 siblings, 2 replies; 3+ messages in thread
From: bugmenot at mailinator dot com @ 2021-12-04  1:53 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28647
           Summary: Python pretty-printer doesn't work with std::variant
                    containing local type
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: bugmenot at mailinator dot com
  Target Milestone: ---

When I compile this program:

```
#include <variant>
#include <vector>

struct G {
    int x;
};

int main() {
    struct A {
        int x;
    };
    A a;
    std::variant<A> b {a};
    std::vector<A> c {a};
    std::variant<G> d {G {}};

    __builtin_trap();
}
```

Then run it in gdb, note that `print b` prints

```
std::variant<> [no contained value]
```

but `print d` prints

```
std::variant<G> [index 0] = {{x = 0}}
```

In the first case the print is wrong.

It's caused by `Type.template_argument` function: If this is called in the
Python shell

```
>>> gdb.lookup_symbol("b")[0].type.template_argument(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: syntax error
```

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

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

* [Bug python/28647] Python pretty-printer doesn't work with std::variant containing local type
  2021-12-04  1:53 [Bug python/28647] New: Python pretty-printer doesn't work with std::variant containing local type bugmenot at mailinator dot com
@ 2021-12-04 20:27 ` ssbssa at sourceware dot org
  2022-01-05 16:26 ` ssbssa at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: ssbssa at sourceware dot org @ 2021-12-04 20:27 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

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

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

* [Bug python/28647] Python pretty-printer doesn't work with std::variant containing local type
  2021-12-04  1:53 [Bug python/28647] New: Python pretty-printer doesn't work with std::variant containing local type bugmenot at mailinator dot com
  2021-12-04 20:27 ` [Bug python/28647] " ssbssa at sourceware dot org
@ 2022-01-05 16:26 ` ssbssa at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: ssbssa at sourceware dot org @ 2022-01-05 16:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
Is this a duplicate of PR20590?

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

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

end of thread, other threads:[~2022-01-05 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04  1:53 [Bug python/28647] New: Python pretty-printer doesn't work with std::variant containing local type bugmenot at mailinator dot com
2021-12-04 20:27 ` [Bug python/28647] " ssbssa at sourceware dot org
2022-01-05 16:26 ` 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).