wstring data formatter

Hi Nino,
just a quick note to keep you in the loop.
After a few minor changes, this is the version of the std::wstring data formatter that we will be testing with for inclusion in the LLDB ToT.
Let me know if you have any suggestions for improvements/changes :slight_smile:

Enrico Granata
:email: egranata@.com
✆ (408) 972-7683

wstring.py (763 Bytes)

Hi Enrico,

I tested the script and there are two points:

1. "_string_summary_size" is undefined

2. I do not know if "return s.encode('utf-8')" is tcorrect. What encoding is the lldb stdout?
     I registered the wstring_SummaryProvider for std::string also and get wrong results.

     std::string aString = "HÄLLÖ WÖRLD!!!";
     std::wstring aString32 = L"HÄLLÖ WÖRLD!!!";
     unsigned short pRawString[] = {'H', 0xc4 , 'L', 'L', 0xD6, 'W', 0xD6, 'R', 'L', 'D', '!', '!', '!', 0 };
     std::basic_string<unsigned short> aString16 = pRawString;

     (lldb) frame variable aString
     (std::string) aString = "HÃ?LLÃ? WÃ?RLD!!!"
     (lldb) frame variable aString16
     (std::basic_string<unsigned short, std::char_traits<unsigned

, std::allocator<unsigned short> >) aString16 = "HÄLLÖWÖRLD!!!"

     (lldb) frame variable aString32
     (std::wstring) aString32 = "HÄLLÖ WÖRLD!!!"

     Maybe thats an stl or compiler issue. When registering the wstring_SummaryProvider for wstring and 16bit strings only everything is fine.

Cheers,

Nino

True. My mistake in copying/pasting. Feel free to define it to whatever value you fancy!

We need to use UTF-8. So that is definitely The Right Thing ™.

Why do you want/need to do that?

Which is what I expect :slight_smile:

Enrico Granata
:email: egranata@.com
✆ (408) 972-7683