[lldb-dev] Printing non-truncated stdlib collections?

Greg Clayton gclayton at apple.com
Mon Nov 4 15:59:44 PST 2013


On Nov 4, 2013, at 3:47 PM, Dun Peal <dunpealer at gmail.com> wrote:

> OK, I posted the original question of this thread as the following bug: http://llvm.org/bugs/show_bug.cgi?id=17805
> 
> Another issue I just stumbled across:
> 
> (lldb) p vec[0]
> error: call to a function 'std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::operator[](unsigned long)' ('_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EEixEm') that is not present in the target
> error: The expression could not be prepared to run in the target


With template code you have to have the function compiled into your binary and that function has to not be inlined and it needs to have a symbol in the symbol table. If you never used the "operator[]" in your code, it won't be available as  a symbol that we can call. We also can instantiate the template code because we don't have enough info. Also if all instances of "operator[]" were inlined, we won't be able to call that function. So this is just a limitation of debugging template code. You might be able to tell the compiler to fully instantiate all template classes, but that will lead to some major code bloat, just for the sake of expression evaluation.

Greg



More information about the lldb-dev mailing list