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