[lldb-dev] Using data formatters to display QString

Enrico Granata egranata at apple.com
Mon Apr 28 08:51:15 PDT 2014

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?

Sent from the iPhone of
Enrico Granata <egranata@🍎.com>

> On Apr 28, 2014, at 7:33 AM, Eran Ifrah <eran.ifrah at gmail.com> wrote:
> Hi,
> I am trying to view the content of a QString, in gdb I could simply type from the command line:
> (gdb)print mystr.toUtf8().constData()
> and I would get the info, can I do something similar with lldb's data formatters (hint: I am getting parse error)? 
> for example:
> type summary add QString --summary-string "${var.toUtf8().constData()}"
> ​So my question is: can I use functions when defining 'type summary' or am I limited to variables members only?
> Thanks,​
> -- 
> Eran Ifrah
> Author of codelite, a cross platform open source C/C++ IDE: http://www.codelite.org
> wxCrafter, a wxWidgets RAD: http://wxcrafter.codelite.org
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140428/2f5baf03/attachment.html>

More information about the lldb-dev mailing list