public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/49090] New: provide a way to recognize defaulted template parameters
@ 2011-05-20 18:45 tromey at gcc dot gnu.org
  2011-05-20 20:16 ` [Bug debug/49090] " redi at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: tromey at gcc dot gnu.org @ 2011-05-20 18:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

           Summary: provide a way to recognize defaulted template
                    parameters
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tromey@gcc.gnu.org


Consider the test case:

template<typename T1, typename T2 = int>
struct K
{
  T1 v1;
  T2 v2;
};

K<int> k;
K<double, double> k2;


It would be nice if the resulting DWARF indicated that k's type
had a defaulted template parameter.  This way, GDB could optionally omit
this parameter when displaying this type.


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
@ 2011-05-20 20:16 ` redi at gcc dot gnu.org
  2013-01-31 19:59 ` jason at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-20 20:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.20 19:35:26
                 CC|                            |redi at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-20 19:35:26 UTC ---
that would be very nice, confirmed


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
  2011-05-20 20:16 ` [Bug debug/49090] " redi at gcc dot gnu.org
@ 2013-01-31 19:59 ` jason at gcc dot gnu.org
  2013-01-31 20:12 ` tromey at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-01-31 19:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2013-01-31 19:58:47 UTC ---
Is GDB actually using the DW_TAG_template_*_param to generate the name of a
type, or just using the pretty name generated by GCC for DW_AT_name?

Note that we don't currently generate those tags for uninstantiated types.


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
  2011-05-20 20:16 ` [Bug debug/49090] " redi at gcc dot gnu.org
  2013-01-31 19:59 ` jason at gcc dot gnu.org
@ 2013-01-31 20:12 ` tromey at gcc dot gnu.org
  2013-01-31 20:18 ` jason at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu.org @ 2013-01-31 20:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #3 from Tom Tromey <tromey at gcc dot gnu.org> 2013-01-31 20:11:36 UTC ---
(In reply to comment #2)
> Is GDB actually using the DW_TAG_template_*_param to generate the name of a
> type, or just using the pretty name generated by GCC for DW_AT_name?
> 
> Note that we don't currently generate those tags for uninstantiated types.

I don't think I understand this last comment.


A recent gdb does use the various template parameters to prettify
type display.  The example in this PR isn't so great, gdb gets
something wrong :(.  However:

(gdb) ptype k
type = struct K<int, int> [with T1 = int, T2 = int] {
    T1 v1;
    T1 v2;
}

I'd like to be able to print:

(gdb) whatis k
type = K<int>

This will make type display in various places more consistent with
what people generally want to see; and anyway there is an option to
peel back the curtain and see the full information.


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-01-31 20:12 ` tromey at gcc dot gnu.org
@ 2013-01-31 20:18 ` jason at gcc dot gnu.org
  2013-01-31 20:26 ` tromey at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-01-31 20:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2013-01-31 20:18:30 UTC ---
(In reply to comment #3)
> > Note that we don't currently generate those tags for uninstantiated types.
> I don't think I understand this last comment.

I mean that if we only see

K<char>* k;

we see K<char>, but we don't need to instantiate it because nothing requires it
to be complete, so in the DWARF we only see a declaration, which doesn't have
the parameter tags.  This probably isn't an issue in practice, as a definition
will be emitted somewhere, and it will have the parameters.


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-01-31 20:18 ` jason at gcc dot gnu.org
@ 2013-01-31 20:26 ` tromey at gcc dot gnu.org
  2013-02-01 17:58 ` jason at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu.org @ 2013-01-31 20:26 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #5 from Tom Tromey <tromey at gcc dot gnu.org> 2013-01-31 20:25:54 UTC ---
(In reply to comment #4)
> (In reply to comment #3)
> > > Note that we don't currently generate those tags for uninstantiated types.
> > I don't think I understand this last comment.
> 
> I mean that if we only see
> 
> K<char>* k;
> 
> we see K<char>, but we don't need to instantiate it because nothing requires it
> to be complete, so in the DWARF we only see a declaration, which doesn't have
> the parameter tags.  This probably isn't an issue in practice, as a definition
> will be emitted somewhere, and it will have the parameters.

Thanks, I see.
I think gdb will do its best under these circumstances.


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-01-31 20:26 ` tromey at gcc dot gnu.org
@ 2013-02-01 17:58 ` jason at gcc dot gnu.org
  2013-02-01 18:18 ` tromey at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-01 17:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-01 17:58:34 UTC ---
What do you think about G++ (also) switching to emitting K<int> for DW_AT_name
in this case?  Would that break GDB type compatibility with other translation
units that had K<int,int>?


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-02-01 17:58 ` jason at gcc dot gnu.org
@ 2013-02-01 18:18 ` tromey at gcc dot gnu.org
  2013-02-01 19:46 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu.org @ 2013-02-01 18:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #7 from Tom Tromey <tromey at gcc dot gnu.org> 2013-02-01 18:18:01 UTC ---
(In reply to comment #6)
> What do you think about G++ (also) switching to emitting K<int> for DW_AT_name
> in this case?  Would that break GDB type compatibility with other translation
> units that had K<int,int>?

Yeah, I think it may confuse name lookup in other cases.
For example, I think methods of this class will still appear
to be in K<int,int>, because that will still be baked into the
mangled form.  So this would mean that finding a method's class
would fail.

Come to think of it I'm not sure how I will make "ptype K<int>"
work given the current state of gdb's symbol tables.  Baby steps...


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-02-01 18:18 ` tromey at gcc dot gnu.org
@ 2013-02-01 19:46 ` jason at gcc dot gnu.org
  2013-02-01 19:48 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-01 19:46 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-01 19:45:51 UTC ---
Does it make sense to you to use DW_AT_default_value as a flag here?


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2013-02-01 19:46 ` jason at gcc dot gnu.org
@ 2013-02-01 19:48 ` jason at gcc dot gnu.org
  2013-02-01 21:44 ` tromey at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-01 19:48 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-01 19:48:10 UTC ---
Created attachment 29331
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29331
patch to add DW_AT_default_value

Like this.


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2013-02-01 19:48 ` jason at gcc dot gnu.org
@ 2013-02-01 21:44 ` tromey at gcc dot gnu.org
  2013-03-17  2:34 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu.org @ 2013-02-01 21:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #10 from Tom Tromey <tromey at gcc dot gnu.org> 2013-02-01 21:44:15 UTC ---
(In reply to comment #8)
> Does it make sense to you to use DW_AT_default_value as a flag here?

That would be fine by me.


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2013-02-01 21:44 ` tromey at gcc dot gnu.org
@ 2013-03-17  2:34 ` jason at gcc dot gnu.org
  2014-07-15 14:05 ` redi at gcc dot gnu.org
  2014-07-15 18:38 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-17  2:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-17 02:33:59 UTC ---
Author: jason
Date: Sun Mar 17 02:33:50 2013
New Revision: 196723

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196723
Log:
    PR debug/49090
    * dwarf2out.c (gen_generic_params_dies): Indicate default arguments
    with DW_AT_default_value.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/langhooks.h


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2013-03-17  2:34 ` jason at gcc dot gnu.org
@ 2014-07-15 14:05 ` redi at gcc dot gnu.org
  2014-07-15 18:38 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-15 14:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
r212555 addresses this issue for certain std::lib types, but not for the
general case


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

* [Bug debug/49090] provide a way to recognize defaulted template parameters
  2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2014-07-15 14:05 ` redi at gcc dot gnu.org
@ 2014-07-15 18:38 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2014-07-15 18:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49090

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> ---
The DWARF attribute was in GCC 4.9.


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

end of thread, other threads:[~2014-07-15 18:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20 18:45 [Bug debug/49090] New: provide a way to recognize defaulted template parameters tromey at gcc dot gnu.org
2011-05-20 20:16 ` [Bug debug/49090] " redi at gcc dot gnu.org
2013-01-31 19:59 ` jason at gcc dot gnu.org
2013-01-31 20:12 ` tromey at gcc dot gnu.org
2013-01-31 20:18 ` jason at gcc dot gnu.org
2013-01-31 20:26 ` tromey at gcc dot gnu.org
2013-02-01 17:58 ` jason at gcc dot gnu.org
2013-02-01 18:18 ` tromey at gcc dot gnu.org
2013-02-01 19:46 ` jason at gcc dot gnu.org
2013-02-01 19:48 ` jason at gcc dot gnu.org
2013-02-01 21:44 ` tromey at gcc dot gnu.org
2013-03-17  2:34 ` jason at gcc dot gnu.org
2014-07-15 14:05 ` redi at gcc dot gnu.org
2014-07-15 18:38 ` jason at gcc dot gnu.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).