public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28946] New: Missing template paramater pack support
@ 2022-03-05 16:08 jengelh at inai dot de
  2022-03-06 14:20 ` [Bug gdb/28946] " ssbssa at sourceware dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jengelh at inai dot de @ 2022-03-05 16:08 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28946
           Summary: Missing template paramater pack support
           Product: gdb
           Version: 11.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: jengelh at inai dot de
  Target Milestone: ---

Input
=====
```
template<typename... T> void f(T&&...zzargs) {}
int main() { f(0); }
```

g++-11 -Wall -ggdb3 x.cpp

Observed output
===============
» gdb a.out
GNU gdb (GDB; openSUSE Tumbleweed) 11.1
...
(gdb) b main
(gdb) r
...
Breakpoint 1, main () at x.cpp:2
2       int main() { f(0); }
Missing separate debuginfos, use: zypper install
libgcc_s1-debuginfo-11.2.1+git1173-2.3.x86_64
libstdc++6-debuginfo-11.2.1+git1173-2.3.x86_64
(gdb) s
f<int> () at x.cpp:1
1       template<typename... T> void f(T&&...zzargs) {}
(gdb) info args
No arguments.
(gdb) p zzargs
No symbol "zzargs" in current context.


Expected output
===============

(gdb) info args
zzargs = {0}
(gdb) p zzargs
$1 = {0}

or something of the sort.

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

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

* [Bug gdb/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
@ 2022-03-06 14:20 ` ssbssa at sourceware dot org
  2022-03-06 14:55 ` ssbssa at sourceware dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2022-03-06 14:20 UTC (permalink / raw)
  To: gdb-prs

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

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] 9+ messages in thread

* [Bug gdb/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
  2022-03-06 14:20 ` [Bug gdb/28946] " ssbssa at sourceware dot org
@ 2022-03-06 14:55 ` ssbssa at sourceware dot org
  2022-03-06 16:49 ` [Bug c++/28946] " tromey at sourceware dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2022-03-06 14:55 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
Note that gcc currently doesn't write the name of the parameter pack in the
debug information:

 <2><95>: Abbrev Number: 5 (DW_TAG_GNU_formal_parameter_pack)
    <96>   DW_AT_decl_file   : 1
    <97>   DW_AT_decl_line   : 1
    <98>   DW_AT_decl_column : 35
 <3><99>: Abbrev Number: 6 (DW_TAG_formal_parameter)
    <9a>   DW_AT_type        : <0xaa>
    <9e>   DW_AT_location    : 2 byte block: 91 0       (DW_OP_fbreg: 0)
 <3><a1>: Abbrev Number: 0

Apparently this has been reported already some time ago:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70536

So even if gdb would make use of DW_TAG_GNU_formal_parameter_pack, it couldn't
show it as `zzargs` in the example.

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

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

* [Bug c++/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
  2022-03-06 14:20 ` [Bug gdb/28946] " ssbssa at sourceware dot org
  2022-03-06 14:55 ` ssbssa at sourceware dot org
@ 2022-03-06 16:49 ` tromey at sourceware dot org
  2022-10-27 21:56 ` dblaikie at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2022-03-06 16:49 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-03-06
          Component|gdb                         |c++
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |tromey at sourceware dot org

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

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

* [Bug c++/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
                   ` (2 preceding siblings ...)
  2022-03-06 16:49 ` [Bug c++/28946] " tromey at sourceware dot org
@ 2022-10-27 21:56 ` dblaikie at gmail dot com
  2023-01-14 12:58 ` ssbssa at sourceware dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dblaikie at gmail dot com @ 2022-10-27 21:56 UTC (permalink / raw)
  To: gdb-prs

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

David Blaikie <dblaikie at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dblaikie at gmail dot com

--- Comment #2 from David Blaikie <dblaikie at gmail dot com> ---
+1 to this from a Clang developer.

Clang does name the template parameter pack.
```
0x0000039a:   DW_TAG_structure_type
                DW_AT_name      ("single_and_pack<int, int>")
                DW_AT_byte_size (1)
                DW_AT_decl_file
("/usr/local/google/home/blaikie/dev/scratch/test.cpp")
                DW_AT_decl_line (9)
                DW_AT_decl_column       (8)
                DW_AT_sibling   (0x000003b7)

0x000003a4:     DW_TAG_template_type_parameter
                  DW_AT_name    ("T1")
                  DW_AT_type    (0x00000094 "int")

0x000003ac:     DW_TAG_GNU_template_parameter_pack
                  DW_AT_name    ("Ts")

0x000003b0:       DW_TAG_template_type_parameter
                    DW_AT_type  (0x00000094 "int")

0x000003b5:       NULL

0x000003b6:     NULL
```

And there's an extra bonus reason from Clang's side:

I'm working on a mode for clang (called -gsimple-template-names) that will
produce DW_AT_names for templates without template parameters in some cases (so
in the above example "single_and_pack") and so working around this bug (missing
structural/API access to template parameters) by using the string name won't be
possible with debug info like this)

(total aside, though this is probably for a conversation on a gdb mailing list
- it does look like gdb does quite a bit of work that looks /a lot/ like it's
intending to support debug info like I described above... anyone happen to have
context on that?)

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

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

* [Bug c++/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
                   ` (3 preceding siblings ...)
  2022-10-27 21:56 ` dblaikie at gmail dot com
@ 2023-01-14 12:58 ` ssbssa at sourceware dot org
  2023-01-14 19:13 ` dblaikie at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2023-01-14 12:58 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Hannes Domani <ssbssa at sourceware dot org> ---
Is related to (or a duplicate of) PR17272.

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

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

* [Bug c++/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
                   ` (4 preceding siblings ...)
  2023-01-14 12:58 ` ssbssa at sourceware dot org
@ 2023-01-14 19:13 ` dblaikie at gmail dot com
  2023-01-16 23:37 ` tromey at sourceware dot org
  2023-01-17  1:00 ` ed at catmur dot uk
  7 siblings, 0 replies; 9+ messages in thread
From: dblaikie at gmail dot com @ 2023-01-14 19:13 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from David Blaikie <dblaikie at gmail dot com> ---
(In reply to Hannes Domani from comment #3)
> Is related to (or a duplicate of) PR17272.

Yeah, dup seems fine

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

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

* [Bug c++/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
                   ` (5 preceding siblings ...)
  2023-01-14 19:13 ` dblaikie at gmail dot com
@ 2023-01-16 23:37 ` tromey at sourceware dot org
  2023-01-17  1:00 ` ed at catmur dot uk
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-01-16 23:37 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Dup.

*** This bug has been marked as a duplicate of bug 17272 ***

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

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

* [Bug c++/28946] Missing template paramater pack support
  2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
                   ` (6 preceding siblings ...)
  2023-01-16 23:37 ` tromey at sourceware dot org
@ 2023-01-17  1:00 ` ed at catmur dot uk
  7 siblings, 0 replies; 9+ messages in thread
From: ed at catmur dot uk @ 2023-01-17  1:00 UTC (permalink / raw)
  To: gdb-prs

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

Ed Catmur <ed at catmur dot uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ed at catmur dot uk

--- Comment #6 from Ed Catmur <ed at catmur dot uk> ---
Hi David, can you let me know whether clang would be able to make use of the
fix in #17272 (see attached patch, linked PR, linked ML post, whatever works
for you)? It would be useful to know whether someone would be able to make use
of it, even if gcc aren't interested in supporting
DW_TAG_GNU_template_parameter_pack.

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

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

end of thread, other threads:[~2023-01-17  1:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-05 16:08 [Bug gdb/28946] New: Missing template paramater pack support jengelh at inai dot de
2022-03-06 14:20 ` [Bug gdb/28946] " ssbssa at sourceware dot org
2022-03-06 14:55 ` ssbssa at sourceware dot org
2022-03-06 16:49 ` [Bug c++/28946] " tromey at sourceware dot org
2022-10-27 21:56 ` dblaikie at gmail dot com
2023-01-14 12:58 ` ssbssa at sourceware dot org
2023-01-14 19:13 ` dblaikie at gmail dot com
2023-01-16 23:37 ` tromey at sourceware dot org
2023-01-17  1:00 ` ed at catmur dot uk

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