[lldb-dev] wstring data formatter

Enrico Granata egranata at apple.com
Wed Aug 8 09:47:13 PDT 2012


On Aug 8, 2012, at 4:41 AM, Nino Kettlitz <nino.kettlitz at googlemail.com> wrote:

> Hi Enrico,
> 
> I tested the script and there are two points:
> 
> 1. "_string_summary_size" is undefined
> 

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

> 2. I do not know if "return s.encode('utf-8')" is tcorrect. What encoding is the lldb stdout?

We need to use UTF-8. So that is definitely The Right Thing (TM).

>     I registered the wstring_SummaryProvider for std::string also and get wrong results.
> 

Why do you want/need to do that?

>     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 short>, 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.
> 

Which is what I expect :-)

> Cheers,
> 
> Nino

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20120808/6f02bfec/attachment.html>


More information about the lldb-dev mailing list