[lldb-dev] synthetic for std::wstring

Enrico Granata granata.enrico at gmail.com
Wed Feb 29 08:04:19 PST 2012


> Hi Enrico,
> 
> I downloaded the latest lldb version from svn (117) and now evereything works as expected:
> 

Glad to hear :)

> (lldb) type summary add --python-function wstring.wstring_summary "std::wstring"
> (lldb) frame variable aWideString
> (std::wstring) aWideString = HELLO WORLD!!!
> 
> When using vectors of std::wstring I had to register the complete template name of std::wstring, but than it worked perfectly.
> 

It is a known scenario that depends on the debug info being emitted by the compiler. You are doing the right thing.
For std::string, we have a few workarounds in place so that users always see their strings no matter whether the long or short typename is used. For std::wstring we do not provide anything out-of-the-box, so you need to set things up this way yourself.

> (lldb) type summary add --python-function wstring.wstring_summary "std::basic_string<int, class std::char_traits<int>, class std::allocator<int> >"
> (lldb) frame variable aWideStringVector
> (vector<std::basic_string<wchar_t>, std::allocator<std::basic_string<wchar_t> > >) aWideStringVector = {
>  [0] = Filter/EQ
>  [1] = Lowpass Filter
>  [2] = Wah Wah
>  [3] = Pitch Shift
>  [4] = Highpass Filter
>  [5] = Bandpass Filter
>  [6] = Combination
>  [7] = Notch Filter
>  [8] = Auto Filter
>  [9] = Distortion
> }
> 
> Now I have two questions:
> - Can I replace the "official" lldb with the one I build, so that I can use it within Xcode?

Most probably it will not work, and Apple does not support it.

> - Is there a possibility to always load the type summary for wstring?
> 

Yes. You can have a .lldbinit file in your home folder and LLDB will load commands from that file whenever it is launched.
An example is here: http://llvm.org/svn/llvm-project/lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit

> thanks,
> Nino
> 

- Enrico Granata
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20120229/298ef3a7/attachment.html>


More information about the lldb-dev mailing list