<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">So I found the problem. This is a compiler bug. The DWARF for this type looks like:<div class=""><br class=""></div><div class="">0x000065da: TAG_structure_type [112] *<br class=""> AT_containing_type( {0x0000000000006628} )<br class=""> AT_name( "derived0<int, int, 1024>" )<br class=""> AT_byte_size( 0x08 )<br class=""> AT_decl_file( "/private/tmp/main.cpp" )<br class=""> AT_decl_line( 9 )<br class=""><br class=""><div><br class=""></div><div>But all of the type info in the symbol table has has the type named as "derived0<int, int, 1024u>”. Note the extra “u” that follows 1024. This stops LLDB from being able to lookup the type correctly so we can show the dynamic type. In LLDB we check the first pointer inside of a class to see if it is a symbol whose name is “<font color="#d12f1b" class=""><span style="font-size: 11px;" class="">vtable for TYPENAME”. If it is, we lookup the type “TYPENAME” to find it. In this case we try to lookup </span></font>"derived0<int, int, 1024u>” and we fail since the DWARF has it as "derived0<int, int, 1024>”.</div><div><br class=""></div><div>I have filed a radar on the compiler here at Apple for the fix.</div><div><br class=""></div><div>Greg</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 6, 2017, at 10:22 AM, Greg Clayton via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I am looking at this now. I will let you know what I find.<div class=""><br class=""></div><div class="">Greg</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 6, 2017, at 10:00 AM, Roman Popov <<a href="mailto:ripopov@gmail.com" class="">ripopov@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Yes, that was my thought. <div class=""><br class=""><div class="">FYI, checked in GDB: it's working correctly on this testcase showing correct dynamic type in both cases.<div class="gmail_extra"><br class=""><div class="gmail_quote">2017-02-06 9:48 GMT-08:00 Greg Clayton <span dir="ltr" class=""><<a href="mailto:gclayton@apple.com" target="_blank" class="">gclayton@apple.com</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">You have found a bug. It should be reporting this correctly but it isn’t. I verified it fails on MacOSX.<div class=""><br class=""></div><div class="">Greg Clayton</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="h5"><div class="">On Feb 5, 2017, at 1:19 PM, Roman Popov via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="m_-2367537013708510783Apple-interchange-newline"></div></div><div class=""><div class=""><div class="h5"><div dir="ltr" class=""><div class="">Hello,</div><div class="">I'm observing very strange LLDB behavior: it does not always shows a correct dynamic type when I ask for.</div><div class=""><br class=""></div><div class="">Originally I was working with LLDB 3.9, but it looks like trunk version behaves the same strange way. </div><div class=""><br class=""></div><div class="">I was able to capture this behavior in a small code snippet: <br class=""></div><div class=""><br class=""></div><div class=""><font face="monospace, monospace" class="">#include <iostream></font></div><div class=""><font face="monospace, monospace" class="">#include <typeinfo></font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">using namespace std;</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">struct base_type { virtual ~base_type(){} };</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">template <class T1, class T2, unsigned SIZE></font></div><div class=""><font face="monospace, monospace" class="">struct derived0 : base_type {};</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">template <class T1, class T2></font></div><div class=""><font face="monospace, monospace" class="">struct derived1 : base_type {};</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">int main(int argc, char ** argv) {</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class=""> base_type * bptr0 = new derived0<int, int, 1024>();</font></div><div class=""><font face="monospace, monospace" class=""> base_type * bptr1 = new derived1<int, int >();</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class=""> cout << typeid(*bptr0).name() << endl;</font></div><div class=""><font face="monospace, monospace" class=""> cout << typeid(*bptr1).name() << endl;</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class=""> return 0;</font></div><div class=""><font face="monospace, monospace" class="">}</font></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div><div class="">lldb --version</div><div class="">lldb version 5.0.0 (<a href="http://llvm.org/svn/llvm-project/lldb/trunk" target="_blank" class="">http://llvm.org/svn/llvm-<wbr class="">project/lldb/trunk</a> revision 293398)</div><div class=""> clang revision 293398</div><div class=""> llvm revision 293398</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Testing in LLDB:</div><div class="">(lldb) break set --file main.cpp --line 22</div><div class=""><br class=""></div><div class="">(lldb) expression -d no-run -- bptr1</div><div class="">(derived1<int, int> *) $2 = 0x0000000000614c40</div><div class=""><br class=""></div><div class="">(lldb) expression -d no-run -- bptr0</div><div class=""><b class="">(base_type *) $3 = 0x0000000000614c20</b></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Can someone explain me why for bptr0 I dont get a <span style="font-family:monospace,monospace" class="">derived0<int, int, 1024> * as I expected?</span></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Roman</div></div></div></div>
______________________________<wbr class="">_________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" target="_blank" class="">lldb-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/lldb-dev</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></div>
</div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></div></body></html>