<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="">You could add an explicit instantiation of your template for C++ types you need. <div class=""><br class=""></div><div class="">Example without:<br class=""><div class=""><br class=""></div><div class=""><div class="">#include <cstdio></div><div class="">#include <vector></div><div class=""><br class=""></div><div class="">int main (int argc, char const *argv[])</div><div class="">{</div><div class=""> std::vector<int> ints = { 1,2,3,4 };</div><div class=""> for (auto i: ints)</div><div class=""> printf("%i\n", i);</div><div class=""> return 0;</div><div class="">}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">(lldb) target create "a.out"<br class="">(lldb) b /auto i/<br class="">(lldb) r<br class="">(lldb) p ints.size()<br class="">error: Couldn't lookup symbols:<br class=""> __ZNKSt3__16vectorIiNS_9allocatorIiEEE4sizeEv<br class=""><br class=""></div><div class=""><br class=""></div><div class="">But add the explicit instantiation:</div><div class=""><br class=""></div><div class=""><div class="">#include <cstdio></div><div class="">#include <vector></div><div class=""><br class=""></div><div class="">template class std::vector<int>; /// <<<<<<<<<</div><div class=""><br class=""></div><div class="">int main (int argc, char const *argv[])</div><div class="">{</div><div class=""> std::vector<int> ints = { 1,2,3,4 };</div><div class=""> for (auto i: ints)</div><div class=""> printf("%i\n", i);</div><div class=""> return 0;</div><div class="">}</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">(lldb) target create "a.out"<br class="">(lldb) b /auto i/<br class="">(lldb) r<br class="">(lldb) p ints.size()<br class="">(std::__1::vector<int, std::__1::allocator<int> >::size_type) $0 = 4<br class=""><br class=""></div><div class=""><br class=""></div><div class="">So you could have some piece of code somewhere in your project:</div><div class=""><br class=""></div><div class="">#ifndef NDEBUG</div><div class="">/// Explicitly instantiate any STL stuff you need in order to debug</div><div class="">#endif</div><div class=""><br class=""></div><div class="">GDB is probably working around this by doing things for you without running the code that doesn’t exist.</div><div class=""><br class=""></div><div class="">Greg</div><div class=""><br class=""></div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Jan 23, 2017, at 3:58 PM, Andreas Yankopolus 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=""><div class="">How can I navigate STL types using their overloaded operators and member functions (e.g., “[]” and “.first()” for vectors) ? For example, take a C++ source file with:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">std::vector<std::string> v;</font></div><div class=""><font face="Monaco" class="">v.push_back("foo”);</font></div><div class=""><br class=""></div><div class="">Breaking after this statement in lldb and typing "p v[0]" would be reasonably expected to return "foo", but it gives a symbol lookup error. Similarly, “p v.first()” gives an error that there’s no member named “first”. I’m seeing this issue with clang/llvm 3.9 and 4.0 nightlies on Ubuntu 16.10 and with Apple’s versions on MacOS Sierra.</div><div class=""><br class=""></div><div class="">Internet rumor (e.g., <a href="http://stackoverflow.com/questions/39680320/printing-debugging-libc-stl-with-xcode-lldb/39731933" class="">this discussion</a>) says this is aggressive inlining of STL code. I’m compiling in clang++ with “-O0 -g -glldb”.</div><div class=""><br class=""></div><div class="">In comparison, gdb prints the value of v[0] just fine when compiled with gdb.</div><div class=""><br class=""></div><div class="">What am I doing wrong?</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></div></body></html>