[lldb-dev] std::vector formatter question

Tamas Berghammer via lldb-dev lldb-dev at lists.llvm.org
Fri Mar 24 09:43:41 PDT 2017


The libstdc++ one is defined in examples/synthetic/gnu_libstdcpp.py while
the libc++ one is defined in
source/Plugins/Language/CPlusPlus/LibCxxVector.cpp and both of them is
registered in source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp by
specifying a type name regex to identify the effected types. If you have a
custom STL or any other costume type I suggest you to write a synthetic
child provider in Python (see https://lldb.llvm.org/varformats.html) as it
can be loaded at runtime so you don't have to fork LLDB.

Tamas

On Fri, Mar 24, 2017 at 4:30 PM Ted Woodward via lldb-dev <
lldb-dev at lists.llvm.org> wrote:

> On standalone Hexagon (no OS support), we use Dinkumware for the c/c++
> library. LLDB isn't able to print out values of a vector:
>
> Process 1 stopped
> * thread #1: tid = 0x0001, 0x0000519c vector.elf`main + 76 at
> vector.cpp:10,
> stop reason = step in
>     frame #0: 0x0000519c vector.elf`main + 76 at vector.c:10
>    7            vector<int> v;
>    8            v.push_back(2);
>    9            v.push_back(1);
> -> 10           cout << v[0] << " " << v[1] << endl;
>    11           return 0;
>    12   }
>  (lldb) fr v v
> (std::vector<int, std::allocator<int> >) v = size=0 {}
>
> When I run on x86 linux built with gcc, I get:
> (lldb) fr v v
> (std::vector<int, std::allocator<int> >) v = size=2 {
>   [0] = 2
>   [1] = 1
> }
>
>
> My guess is Dinkumware's vector type is just a little bit different from
> libstdc++/libcxx, so the standard formatters don't do the right thing.
> Where
> are the vector<int> formatters defined, and how does LLDB determine which
> one to use?
>
>
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
> Linux Foundation Collaborative Project
>
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170324/5abcdeaf/attachment.html>


More information about the lldb-dev mailing list