[lldb-dev] Using data formatters to display QString

Enrico Granata egranata at apple.com
Mon Apr 28 09:46:03 PDT 2014


On Apr 28, 2014, at 9:41 AM, Konstantin Tokarev <annulen at yandex.ru> wrote:

> 
> 28.04.2014, 19:56, "Enrico Granata" <egranata at apple.com>:
>> You can't use expressions in summary strings.
>> We have thought about this several times and have a couple ideas on how it could be done but for now it's not there.
>> 
>> If you need to resort to an expression, you can use a python formatter instead and then you are free to call as many expressions as you like.
>> 
>> However, this will cause a slowdown - running expressions is not free - and if you ever need to make sure nothing is altering your program state, running expressions might not be a safe bet.
>> Is there really no other way to get to those UTF8 bytes?
> 
> QString stores UTF16 data inside.
> 

That is easy to deal with - refer to examples/summaries/unicode_strings.py in the LLDB source tree

All you want to do is take the utf16_summary function, and adjust it to reflect the innards of QString (what is the name of the child that contains the bytes, what is the name of the child that contains the length) - then you can tuck that function away in some file, and register it as a summary for QString - all without calling functions in the inferior process!

> -- 
> Regards,
> Konstantin

- Enrico
📩 egranata@.com ☎️ 27683



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140428/5a29d592/attachment.html>


More information about the lldb-dev mailing list