<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;}
@font-face
{font-family:Menlo;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.gmail-p1, li.gmail-p1, div.gmail-p1
{mso-style-name:gmail-p1;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.gmail-s1
{mso-style-name:gmail-s1;}
span.gmail-apple-converted-space
{mso-style-name:gmail-apple-converted-space;}
span.gmail-s2
{mso-style-name:gmail-s2;}
p.gmail-p2, li.gmail-p2, div.gmail-p2
{mso-style-name:gmail-p2;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.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">Fully expanded names of template instantiations can become impressively large, yeah.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The DWARF Wiki’s Best Practices page <a href="http://wiki.dwarfstd.org/index.php?title=Best_Practices">
http://wiki.dwarfstd.org/index.php?title=Best_Practices</a> recommends including a canonical form of the template parameters in the DW_AT_name attribute. I don’t know that I agree; it talks about omitting qualifiers (namespaces, containing classes) because
those can be reconstructed from the DIE hierarchy, but the same argument can be made for template parameters (the difference being that qualifiers come from higher up the tree, while template parameters come from farther down). The DRY principle would seem
to apply here.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ll verify with our debugger team, but I’m confident that dropping the <params> from the type name will not affect Sony, as our debugger looks at the template-parameter children already (that’s why we have that turned on by default for
sce tuning). LLDB seems to be the odd debugger out, here, and we have some control over that.
<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">Oh, is there any consequence for deduplication in LTO? Isn’t that name-based?<o:p></o:p></p>
<p class="MsoNormal">--paulr<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> David Blaikie <dblaikie@gmail.com> <br>
<b>Sent:</b> Friday, June 4, 2021 9:33 PM<br>
<b>To:</b> llvm-dev <llvm-dev@lists.llvm.org>; Robinson, Paul <paul.robinson@sony.com>; Adrian Prantl <aprantl@apple.com>; Jonas Devlieghere <jdevlieghere@apple.com>; Henderson, James <James.Henderson@sony.com>; Caroline Tice <cmtice@google.com>; Eric Christopher
<echristo@gmail.com><br>
<b>Subject:</b> [DWARF] using simplified template names<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">tl;dr: What if we used only the base name of templates in the DW_AT_name field for function and class templates (eg: "vector" instead of "vector<int, std::allocator<int>>")?<br>
<br>
<span style="font-size:13.5pt">Context:</span><br>
We (at Google) have been seeing some significant DWARF growth in binaries lately due to increased use of libraries like Eigen and TensorFlow that use expression templates.<br>
<br>
This includes some cases where the debug_str.dwo section has exceeded the DWARF32 limit (& the binutils dwp tool silently wrote overflowed indexes into the debug_str_offsets.dwo section, unfortunately - leading to corrupted/garbled names in backtraces) & most
of the growth is from the demangled names of complicated/large expression templates.<br>
<br>
<span style="font-size:13.5pt">Options:</span><br>
One solution would be to move to DWARF64 - though that does make DWARF overall larger, which is an unfortunate cost that would be nice to avoid.<br>
<br>
Another might be to rely solely on linkage names (add linkage names to types), since mangled names generally reduce a lot of the duplication - though in some cases it's not a matter of duplication within a single name, but possibly many distinct types used
as template parameters - though those types may also be used in other names (& mangled names have no sharing across names).<br>
<br>
Compression doesn't help, since the offsets are into the uncompressed data.<br>
<br>
<span style="font-size:13.5pt">Main idea:<br>
</span>What if templates instead only encoded the base name, such as "vector" (rather than "vector<int, std::allocator<int>>")? The full name could still be reconstructed from the DW_TAG_template_type_parameters (non-type template parameters would be more difficult,
and we'd need to add template parameters to template declarations - functionality we have, but is only enabled for SCE today)).<br>
<br>
This could significantly reduce debug info size (in some worst-cases I've seen this lead to a 50% reduction in the uncompressed size of .debug_str.dwo in a dwp file, for instance - probably less exciting if the data was compressed - but gives a sense of the
headroom available before this limit will be reached again).<br>
<br>
Also has the nice property that it's not a new format or encoding that might break existing consumers immediately (DWARF64, for instance isn't widely implemented to my knowledge, so many consumers would need to be fixed before they could parse any of it) -
if a consumer doesn't know, it'll still see a name, just not the most fully descriptive/specific name it could be. For a symbolizer this is probably fairly low cost - users would find it more difficult, but not totally useless to get a simple template function
name.<br>
<br>
As it happens, it seems GDB is already built to cope with this situation - it can print the real name of the type and can even correctly match up two distinct type declarations between translation units by correctly matching their template parameters.<br>
<br>
GDB Example:<br>
a.h:<o:p></o:p></p>
<blockquote style="margin-left:30.0pt;margin-right:0in">
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">template<typename T></span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">struct t1 { T t = sizeof(T); };</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">void f(t1<int> &p1, t1<short> *&p2);</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal">a.cpp:<o:p></o:p></p>
<blockquote style="margin-left:30.0pt;margin-right:0in">
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">#include "a.h"</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">int main() {</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">t1<int> v1;</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">t1<short> *v2 = nullptr;</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">t1<bool> *v3 = nullptr;</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">f(v1, v2);</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">}</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal">b.cpp:<o:p></o:p></p>
<blockquote style="margin-left:30.0pt;margin-right:0in">
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">#include "a.h"</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">void f(t1<int> &p1, t1<short> *&p2) {</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">static t1<short> v2;</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">p2 = &v2;</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">}</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><br>
// using a clang modified to produce simple template names, and <br>
// to include template parameters on declarations <br>
// (-Xclang -debug-forward-template-params)<br>
$ clang++ a.cpp b.cpp -g<br>
$ llvm-dwarfdump a.out (glossing over some details)<br>
<br>
<o:p></o:p></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG</span></span><span class="gmail-s2"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">_compile_unit</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s2"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("a.cpp")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_structure_type</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("t1")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_template_type_parameter</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_type</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(0x00000098 "int")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("T")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_member</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("t")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"> </span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_type</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(0x00000098 "int")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_structure_type</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("t1")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_declaration
</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(true)</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_template_type_parameter</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_type</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(0x000000e2 "short")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("T")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_structure_type</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("t1")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_declaration
</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(true)</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_template_type_parameter</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_type</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(0x000000fd "bool")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("T")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_compile_unit</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("b.cpp")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_structure_type</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("t1")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_template_type_parameter</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_type</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(0x0000019e "short")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("T")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_member</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in"><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("t")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"> </span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_type</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(0x0000019e "short")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_structure_type</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("t1")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_declaration
</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(true)</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_TAG_template_type_parameter</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_type</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(0x000001b9 "int")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">DW_AT_name</span></span><span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">("T")</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><br>
<span class="gmail-s1">$ gdb ./a.out</span><o:p></o:p></span></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0in">
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(gdb) start</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(gdb) ptype v1</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">type = struct t1<int> [with T = int] {</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">T t;</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">}</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(gdb) ptype v2</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">type = struct t1<short> [with T = short] {</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">T t;</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">} *</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(gdb) ptype v3</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">type = struct t1<bool> {</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p2" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">
</span></span><span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:#747474"><incomplete type></span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:#747474"><o:p></o:p></span></p>
</div>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">} *</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(gdb) ptype v1.t</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">type = int</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(gdb) ptype v2->t</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">type = short</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">(gdb) ptype v3->t</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-s1"><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black">There is no member named t.</span></span><span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p></o:p></span></p>
</div>
</blockquote>
<div>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p> </o:p></span></p>
<p class="gmail-p1" style="margin:0in;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo",serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">So in this example we have one instantiation (t1<int>) declared in the first CU and defined in the second, one instantation (t1<short>) declared in the first and defined in the second, and a third instantiation
(t1<bool>) declared in the first and not defined anywhere.<br>
<br>
GDB has correctly rendered the type names, despite lacking the template parameter lists being in the DW_AT_name - and has correctly associated the definitions with the declarations despite the DW_AT_name being ambiguous, by using the DW_TAG_template_type_parameters.<br>
<br>
lldb doesn't cope with this sort of DWARF currently - it has a bunch of assumptions about the names of template instantiations that'll need to be fixed before it can consume this sort of thing.<br>
<br>
I haven't tested a wide number of symbolizers, but I assume they'll generally need some work too.<br>
<br>
So... how's this sound to everyone? An idea worth pursuing? Concerns/questions/etc.<br>
<br>
I don't expect this to become the default for LLVM in the short term at least - but under a flag for those whose consumers can handle it (/maybe/ we do it under debugger tuning for gdb, since it seems OK with it - but that might be a bit stronger than we want
to do under the default tuning, since it's really broken for lldb, not just a little bit broken).<br>
<br>
- Dave<o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>