lldb debugging: custom summary for a vector's elements (c++)


I’m not sure this is the place to cry for help. If not, please forgive me for this email.
I have been struggling with this issue for days and I cannot find any solution.

I have a custom class MyNameSpace::String for which I created a summary in lldb. For instance, for a MyNameSpace::String myString="a string", here is the summary in lldb:

frame variable myString
   (MyNameSpace::String) myString = "a string"

How can I get a summary for a std::vector<MyNameSpace::String>vecString that look as a summary of a std::vector<std::string>vec?

So far, here are results of the command frame variable on the different variables:

  • vector of standard string

    frame variable vec
    (std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >) vec = size=3 {
    [0] = "str1"
    [1] = "str2"
    [2] = "str3"
  • vector of my custom String

    frame variable vecString
    (std::__1::vector< MyNameSpace::String, std::__1::allocator< MyNameSpace::String> >) vecString = size=2 {
      [0] = {
        value = 7453010373645639777
      [1] = {
        value = 18302628889929726940

How can I get my custom summary to be applied to my vector’s elements?

Thank you very much for any help.


Can you run one command for me?
frame variable --show-types – vecString

I suspect some “foul play” in the type name
as rendered by the vector, such that your formatter is not
getting selected because of a trivial name mismatch.


  • Enrico