public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/30489] New: gdb.Type.template_argument issue when using __int128 unsigned
@ 2023-05-25 13:45 werwolv98 at gmail dot com
2023-05-25 16:03 ` [Bug python/30489] " tromey at sourceware dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: werwolv98 at gmail dot com @ 2023-05-25 13:45 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30489
Bug ID: 30489
Summary: gdb.Type.template_argument issue when using __int128
unsigned
Product: gdb
Version: 13.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: python
Assignee: unassigned at sourceware dot org
Reporter: werwolv98 at gmail dot com
Target Milestone: ---
Using the default libstdc++ pretty printer that ships with GCC 13.1, GDB fails
to parse the template types of `std::variant` (and others) as soon as one of
the template types used is a `__int128 unsigned`.
The pretty printer seems to use `Type.template_argument(n)` under the hood
which throws a `RuntimeError: syntax error` if one of the types is a unsigned
int128 type. This leads to GDB not printing the template types and acts as if
the variant contains no value.
```
std::variant<__uint128_t, int> a;
std::variant<__int128_t, int> b;
```
```
(gdb) print a
$1 = std::variant<> [no contained value]
(gdb) print b
$2 = std::variant<__int128, int> [index 0] = {0}
```
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug python/30489] gdb.Type.template_argument issue when using __int128 unsigned
2023-05-25 13:45 [Bug python/30489] New: gdb.Type.template_argument issue when using __int128 unsigned werwolv98 at gmail dot com
@ 2023-05-25 16:03 ` tromey at sourceware dot org
2023-05-26 6:18 ` werwolv98 at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-05-25 16:03 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30489
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-05-25
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |tromey at sourceware dot org
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to WerWolv from comment #0)
> The pretty printer seems to use `Type.template_argument(n)` under the hood
> which throws a `RuntimeError: syntax error` if one of the types is a
> unsigned int128 type.
Can you post the Python stack trace for this?
Anyway I was able to reproduce the behavior, even with git master --
eliminating my theory that maybe the recent 128-bit work fixed this.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug python/30489] gdb.Type.template_argument issue when using __int128 unsigned
2023-05-25 13:45 [Bug python/30489] New: gdb.Type.template_argument issue when using __int128 unsigned werwolv98 at gmail dot com
2023-05-25 16:03 ` [Bug python/30489] " tromey at sourceware dot org
@ 2023-05-26 6:18 ` werwolv98 at gmail dot com
2023-05-26 19:28 ` tromey at sourceware dot org
2023-05-26 21:23 ` tromey at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: werwolv98 at gmail dot com @ 2023-05-26 6:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30489
--- Comment #2 from WerWolv <werwolv98 at gmail dot com> ---
(In reply to Tom Tromey from comment #1)
> (In reply to WerWolv from comment #0)
>
> > The pretty printer seems to use `Type.template_argument(n)` under the hood
> > which throws a `RuntimeError: syntax error` if one of the types is a
> > unsigned int128 type.
>
> Can you post the Python stack trace for this?
>
> Anyway I was able to reproduce the behavior, even with git master --
> eliminating my theory that maybe the recent 128-bit work fixed this.
I wrote a small test script that simply tries to print the first template type
name as value of the type. The stacktrace for that is
```
Traceback (most recent call last):
File "<string>", line 15, in to_string
File "<string>", line 5, in get_template_arg_list
RuntimeError: syntax error
```
The only place I could find "syntax error" in the codebase was in the parser so
I assume it's comming from there somewhere.
With the original libstdc++ pretty printer you don't get any stacktrace at all
because they use a try-except in their get_template_arg_list as terminating
condition which fails on the first try so it just returns an empty list of
template types
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug python/30489] gdb.Type.template_argument issue when using __int128 unsigned
2023-05-25 13:45 [Bug python/30489] New: gdb.Type.template_argument issue when using __int128 unsigned werwolv98 at gmail dot com
2023-05-25 16:03 ` [Bug python/30489] " tromey at sourceware dot org
2023-05-26 6:18 ` werwolv98 at gmail dot com
@ 2023-05-26 19:28 ` tromey at sourceware dot org
2023-05-26 21:23 ` tromey at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-05-26 19:28 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30489
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Ok, thanks, I think I see the problem now.
The "syntax error" means that gdb is falling back on the
old-style name-parsing approach to extracting template
parameters. This method shouldn't really be needed with
contemporary compilers, though. So digging a bit deeper
& looking at the DWARF, the type of a variant in my test
program is:
<2><a73>: Abbrev Number: 56 (DW_TAG_class_type)
<a74> DW_AT_name : (indirect string, offset: 0x1216):
variant<__int128 unsigned, char const*>
[...]
<3><c09>: Abbrev Number: 12 (DW_TAG_GNU_template_parameter_pack)
<c0a> DW_AT_name : (indirect string, offset: 0x21b1): _Types
<4><c0e>: Abbrev Number: 3 (DW_TAG_template_type_param)
<c0f> DW_AT_type : <0x14a9>
<4><c13>: Abbrev Number: 3 (DW_TAG_template_type_param)
<c14> DW_AT_type : <0x1532>
I suspect what is going on is that the Python code
doesn't understand parameter packs; or that maybe these
aren't registered with the type in a usable way.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug python/30489] gdb.Type.template_argument issue when using __int128 unsigned
2023-05-25 13:45 [Bug python/30489] New: gdb.Type.template_argument issue when using __int128 unsigned werwolv98 at gmail dot com
` (2 preceding siblings ...)
2023-05-26 19:28 ` tromey at sourceware dot org
@ 2023-05-26 21:23 ` tromey at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-05-26 21:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30489
--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
See bug #17272
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-26 21:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 13:45 [Bug python/30489] New: gdb.Type.template_argument issue when using __int128 unsigned werwolv98 at gmail dot com
2023-05-25 16:03 ` [Bug python/30489] " tromey at sourceware dot org
2023-05-26 6:18 ` werwolv98 at gmail dot com
2023-05-26 19:28 ` tromey at sourceware dot org
2023-05-26 21:23 ` tromey 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).