<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">I heard back from our debugger folks (actually they replied a couple weeks ago and I missed the notification somehow). They compliment you on the interesting test cases.
<span style="font-family:"Segoe UI Emoji",sans-serif">😊</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For the case of a pointer template parameter, “template<int*> void f1() { … }; int g; … f1<&g>();” where “g” has address 0x1234, this indeed would get reconstructed as “f1<0x1234>” although now that you’ve brought it up, they’ve raised
an internal ticket to look at symbolizing that. I agree with your point that if “g” is defined in another CU and not compiled with debug info, there might be no more than an external declaration in the current CU’s DWARF to look at, and so information outside
of DWARF would be needed to symbolize that. I don’t know about this case specifically but I have seen gdb make use of the ELF symbol table to derive information that isn’t present in the DWARF, so it’s not unprecedented. I think for your round-tripping purposes,
if the symbol _<i>is</i>_ in the DWARF you could symbolize it, and for the other cases have to be content with falling back to the pointer literal.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For the second case, using as example code<o:p></o:p></p>
<p class="MsoNormal" style="background:#F4F5F7"><span style="font-size:9.0pt;font-family:"Courier New";color:#172B4D">template<typename T> void f1() {}<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#F4F5F7"><span style="font-size:9.0pt;font-family:"Courier New";color:#172B4D">class {} x;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#F4F5F7"><span style="font-size:9.0pt;font-family:"Courier New";color:#172B4D">auto y = []{};<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#F4F5F7"><span style="font-size:9.0pt;font-family:"Courier New";color:#000091">int</span><span style="font-size:9.0pt;font-family:"Courier New";color:#172B4D"> main() {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#F4F5F7"><span style="font-size:9.0pt;font-family:"Courier New";color:#172B4D"> f1<decltype(x)>();<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#F4F5F7"><span style="font-size:9.0pt;font-family:"Courier New";color:#172B4D"> f1<decltype(y)>();<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#F4F5F7"><span style="font-size:9.0pt;font-family:"Courier New";color:#172B4D">}<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">this conjures up generated names on the order of<o:p></o:p></p>
<pre style="background:#F4F5F7"><span style="font-size:9.0pt;color:#172B4D">f1<(anon_class:0x4D62500372C58A1A)><o:p></o:p></span></pre>
<pre style="background:#F4F5F7"><span style="font-size:9.0pt;color:#172B4D">f1<(anon_class:0x4D62500372C58A65)><o:p></o:p></span></pre>
<p class="MsoNormal">which is admittedly not great, syntactically not identifiers for one thing. Not something anyone has complained about and so not something they’ve thought to look at before, although again there’s now an internal ticket to see about improving
this. For your round-tripping, I guess coming up with some name-generation system for anonymous types would have to do, although whether you can easily leave enough breadcrumbs to walk back from the template parameter type to the type-of-x seems like a question.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Sorry I can’t provide any cleverness here.<o:p></o:p></p>
<p class="MsoNormal">--paulr<o:p></o:p></p>
</div>
</body>
</html>