<div dir="ltr">This came up not too long ago: <a href="https://reviews.llvm.org/D39622">https://reviews.llvm.org/D39622</a><br><br>I'm leaning towards accepting at least some uniform naming scheme (rather than, say "enum X { Y = 0, Z = 0 };" as a template parameter with foo<Z> named as foo<Y> and foo<(X)1> as foo<1> - maybe they should all be, as GCC does, foo<(X)N>).<br><br>It's a slightly awkward thing to require that the GDB demangler and Clang's naming match letter-for-letter (& I think GDB's matching is a bit fuzzier than that - I seem to recall seeing it handle some differences in whitespace, maybe in parentheses/casts?).<br><br>- Dave<br><br><div class="gmail_quote"><div dir="ltr">On Fri, Jan 26, 2018 at 1:28 PM Roman Popov via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I've put the same question on stackoverflow: <div><a href="https://stackoverflow.com/questions/48469750/debugging-clang-generated-rtti-code-with-gdb" target="_blank">https://stackoverflow.com/questions/48469750/debugging-clang-generated-rtti-code-with-gdb</a></div><div><br></div><div>Maybe GDB is the problem, not Clang?</div><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-01-25 21:03 GMT-08:00 Roman Popov <span dir="ltr"><<a href="mailto:ripopov@gmail.com" target="_blank">ripopov@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I'm using Clang++ together with GDB. I've noticed that for some polymorphic classes GDB does not shows correct dynamic type.  After some investigation it turned out that Clang puts different typenames in DWARF and RTTI :</div><div><br></div><div>I have a template class:</div><div><br></div><div><div><font face="monospace, monospace" size="1">template< class T, sc_writer_policy POL></font></div><div><font face="monospace, monospace" size="1">class sc_signal : public sc_object</font></div></div><div><br></div><div>where sc_writer_policy is an enum:</div><div><div><br></div><div><font face="monospace, monospace" size="1">enum sc_writer_policy</font></div><div><font face="monospace, monospace" size="1">{</font></div><div><font face="monospace, monospace" size="1">  SC_ONE_WRITER        = 0, </font></div><div><font face="monospace, monospace" size="1">  SC_MANY_WRITERS      = 1, </font></div><div><font face="monospace, monospace" size="1">  SC_UNCHECKED_WRITERS = 3</font></div><div><font face="monospace, monospace" size="1">};</font></div></div><div><br></div><div><br></div><div>When I debug polymorphic objects of this class I got GDB errors like this:</div><div><br></div><div><div><font face="monospace, monospace" size="1">warning: RTTI symbol not found for class 'sc_core::sc_signal<int, (sc_core::sc_writer_policy)0>'</font></div></div><div><br></div><div><br></div><div>The source of the problem is that it type name seems to be saved differently in RTTI and Debug info.  </div><div><br></div><div>From GDB:</div><div><div><font face="monospace, monospace" size="1">(gdb) info types sc_signal<int</font></div><div><font face="monospace, monospace" size="1">All types matching regular expression "sc_signal<int":</font></div><div><b><font face="monospace, monospace" size="1">sc_core::sc_signal<int, sc_core::SC_ONE_WRITER><br></font></b></div></div><div><br></div><div><div>Using RTTI:</div><div><br></div><div><font face="monospace, monospace" size="1">cout << typeid(*obj).name();</font></div></div><div><div><font face="monospace, monospace" size="1">N7sc_core9sc_signalIiLNS_16<b>sc_writer_policyE0</b>EEE</font></div></div><div><br></div><div>So in RTTI we have <font face="arial, helvetica, sans-serif">mangled sc_core::sc_signal<int, (sc_core::sc_writer_policy)0></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Is it possible to make Clang emitting same type-name in both cases? </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Originally I've discovered this issue with Clang++5.0.  Just tried with Clang++6.0 and it is still there.</font></div><div><font face="arial, helvetica, sans-serif">g++ 5.4 and g++7.0 both work fine, (sc_core::sc_signal<int, (sc_core::sc_writer_policy)0> is generated in both cases)</font></div><div><font face="arial, helvetica, sans-serif"> </font></div><div><font face="arial, helvetica, sans-serif">Thanks,</font></div><div><font face="arial, helvetica, sans-serif">Roman</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><br></div></div>
</blockquote></div><br></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>