<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">The only way for us to find all classes whose type is "C" is to add the entry for all template classes named "C", so I would vote to add them as it is accurate. Do we currently add one for "C<12, 16>"?<div class=""><br class=""></div><div class="">Greg<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 8, 2018, at 8:58 AM, Frédéric Riss via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class="Apple-interchange-newline"><br class=""><blockquote type="cite" class=""><div class="">On May 8, 2018, at 8:30 AM,<span class="Apple-converted-space"> </span><a href="mailto:paul.robinson@sony.com" class="">paul.robinson@sony.com</a><span class="Apple-converted-space"> </span>wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">-----Original Message-----<br class="">From: lldb-commits [<a href="mailto:lldb-commits-bounces@lists.llvm.org" class="">mailto:lldb-commits-bounces@lists.llvm.org</a>] On Behalf<br class="">Of Pavel Labath via lldb-commits<br class="">Sent: Tuesday, May 08, 2018 10:48 AM<br class="">To:<span class="Apple-converted-space"> </span><a href="mailto:friss@apple.com" class="">friss@apple.com</a><br class="">Cc:<span class="Apple-converted-space"> </span><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a><br class="">Subject: Re: [Lldb-commits] [RFC] Type lookup for template types is<br class="">broken...<br class=""><br class="">Well.. it encodes some assumptions about how a class name looks like,<br class="">which<br class="">are probably valid for C++, but they don't have to hold for any language<br class="">frontend LLVM supports. That said, I am not saying this is worth the<br class="">trouble of adding a special "these are the additional names you are to<br class="">insert into the index" channel that clang should use to communicate this<br class="">(I<br class="">wouldn't be surprised if we make even stronger assumptions elsewhere). I<br class="">was just curious about what your thoughts here were.<br class=""></blockquote><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">If you add an accelerator entry for "C" what does it point to?  All the</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">instantiations of "C"?  The DWARF does not describe the template, only</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">the concrete instances.</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div></blockquote><div class=""><br class=""></div><div class="">Yes, there would be a “C” entry for every instantiation of C.</div><div class=""><br class=""></div><div class="">Fred</div><br class=""><blockquote type="cite" class=""><div class=""><span class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">--paulr</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">On Tue, 8 May 2018 at 15:29, Frédéric Riss <<a href="mailto:friss@apple.com" class="">friss@apple.com</a>> wrote:<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On May 8, 2018, at 2:23 AM, Pavel Labath <<a href="mailto:labath@google.com" class="">labath@google.com</a>> wrote:<br class=""></blockquote><br class=""><blockquote type="cite" class="">I am still building a picture for myself of how the accelerator tables<br class=""></blockquote>and<br class=""><blockquote type="cite" class="">our name lookup works, but from what I managed to learn so far, adding<br class=""></blockquote>an<br class=""><blockquote type="cite" class="">accelerator for "C" seems like a useful thing to do. However, this does<br class=""></blockquote>go<br class=""><blockquote type="cite" class="">beyond what the DWARF 5 spec says we should do (we are only required to<br class=""></blockquote>add<br class=""><blockquote type="cite" class="">the DW_AT_name string). We are still free to add any extra entries we<br class=""></blockquote>like,<br class=""><blockquote type="cite" class="">but if we're going to be relying on this, we should try to get some of<br class=""></blockquote>this<br class=""><blockquote type="cite" class="">into the next version of the spec.<br class=""></blockquote><br class=""><br class=""><blockquote type="cite" class="">On Mon, 7 May 2018 at 22:19, Frédéric Riss via lldb-commits <<br class=""><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:<br class=""></blockquote><br class=""><blockquote type="cite" class="">(...At least when using accelerator tables)<br class=""></blockquote><br class=""><br class=""><blockquote type="cite" class="">If you apply the following patch, TestClassTemplateParameterPack.py will<br class=""></blockquote><br class=""><blockquote type="cite" class="">start failing:<br class=""></blockquote><br class=""><blockquote type="cite" class="">diff --git<br class=""></blockquote><br class=""><br class="">a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-<br class="">pack/main.cpp<br class=""><br class="">b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-<br class="">pack/main.cpp<br class=""><br class=""><blockquote type="cite" class="">index 90e63b40f..304872a15 100644<br class="">---<br class=""></blockquote><br class=""><br class="">a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-<br class="">pack/main.cpp<br class=""><br class=""><blockquote type="cite" class="">+++<br class=""></blockquote><br class=""><br class="">b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-<br class="">pack/main.cpp<br class=""><br class=""><blockquote type="cite" class="">@@ -37,7 +37,7 @@ template <> struct D<int, int, bool> : D<int, int> {<br class=""></blockquote><br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class=""> int main (int argc, char const *argv[])<br class=""> {<br class="">-    C<int,16,32> myC;<br class="">+    C<int,16,32> myC; //% self.runCmd("settings set<br class=""></blockquote><br class=""><blockquote type="cite" class="">target.experimental.inject-local-vars false")<br class=""></blockquote><br class=""><blockquote type="cite" class="">     C<int,16> myLesserC;<br class="">     myC.member = 64;<br class="">     (void)C<int,16,32>().isSixteenThirtyTwo();<br class=""></blockquote><br class=""><br class=""><blockquote type="cite" class="">The test does things like invoke methods on temporary template objects:<br class="">//% self.expect("expression -- C<int, 16>().isSixteenThirtyTwo()",<br class=""></blockquote><br class=""><blockquote type="cite" class="">DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])<br class=""></blockquote><br class=""><blockquote type="cite" class="">The above expression currently works because there’s a local of type<br class=""></blockquote><br class=""><blockquote type="cite" class="">C<int, 16>. With injected locals, the type is made readily available to<br class="">Clang. No type lookup is required for this to work in this setup.<br class=""></blockquote><br class=""><blockquote type="cite" class="">If you stop injecting locals, the test fails. We don’t provide the<br class=""></blockquote><br class=""><blockquote type="cite" class="">information to Clang to understand what C is. The reason is that when<br class=""></blockquote>Clang<br class=""><blockquote type="cite" class="">parses “C<int , 16>”, it is going to ask about “C”, not the fully<br class=""></blockquote>templated<br class=""><blockquote type="cite" class="">name. Our accelerator tables contain references to the full names, but<br class=""></blockquote>not<br class=""><blockquote type="cite" class="">to C alone and we never find it. If I change Clang and dsymutil to add<br class=""></blockquote>an<br class=""><blockquote type="cite" class="">accelerator for “C” each time an instance of C is seen then it nearly<br class="">works. I just need this additional lldb patch:<br class=""></blockquote><br class=""><blockquote type="cite" class="">diff --git a/source/Symbol/TypeMap.cpp b/source/Symbol/TypeMap.cpp<br class="">index 2838039ad..d2f2026bf 100644<br class="">--- a/source/Symbol/TypeMap.cpp<br class="">+++ b/source/Symbol/TypeMap.cpp<br class="">@@ -227,8 +227,11 @@ void TypeMap::RemoveMismatchedTypes(const<br class=""></blockquote><br class=""><blockquote type="cite" class="">std::string &type_scope,<br class=""></blockquote><br class=""><blockquote type="cite" class="">       } else {<br class="">         // The type we are currently looking at doesn't exists in a<br class=""></blockquote><br class=""><blockquote type="cite" class="">namespace<br class=""></blockquote><br class=""><blockquote type="cite" class="">         // or class, so it only matches if there is no type scope...<br class="">-        keep_match =<br class="">-            type_scope.empty() &&<br class=""></blockquote>type_basename.compare(match_type_name)<br class=""><br class=""><blockquote type="cite" class="">== 0;<br class=""></blockquote><br class=""><blockquote type="cite" class="">+        if (type_scope.empty()) {<br class="">+          keep_match = type_basename.compare(match_type_name) == 0 ||<br class="">+            (strlen(match_type_name) > type_basename.size() &&<br class="">+             match_type_name[type_basename.size()] == '<');<br class="">+        }<br class="">       }<br class="">     }<br class=""></blockquote><br class=""><br class=""><blockquote type="cite" class="">I didn’t post this as a Phabricator review as it requires changes in<br class=""></blockquote>llvm<br class=""><br class=""><blockquote type="cite" class="">before doing anything in LLDB and I wanted to make sure we agree this is<br class="">the right thing to do. I’m also not sure if this works out of the box on<br class="">platforms without accelerator tables.<br class=""></blockquote><br class=""><blockquote type="cite" class="">It won't work "out of the box", but it should be fairly simple to change<br class="">our indexing code to add the extra entries, so that a lookup for "C"<br class=""></blockquote>works<br class=""><blockquote type="cite" class="">the same way in both cases. BTW, how were you planning to compute the<br class="">untemplated string ("C"). Will you just strip everything after the first<br class="">'<' character, or were you thinking of something more fancy?<br class=""></blockquote><br class=""><br class=""><blockquote type="cite" class="">AFAIK, there are no fully qualified names in the debug info we generate<br class=""></blockquote>so taking what’s before the first ‘<‘ should always return the class name.<br class="">Does this logic seem flawed?<br class=""><br class=""><blockquote type="cite" class="">Fred<br class=""></blockquote>_______________________________________________<br class="">lldb-commits mailing list<br class=""><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a></blockquote></div></blockquote></div><br class="" style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">lldb-commits mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a></span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a></span></div></blockquote></div><br class=""></div></body></html>