Search code examples
objective-cxcodemacosdebugginglldb

LLDB summary strings - how to make them persist over Xcode sessions


I am defining lldb summary strings while debugging a program in Xcode 5, for example

    type summary add -s "${var._operation} ${var._text}" DMDiff 

This works fine. However, when I close Xcode, restart it and continue debugging the session, my summary strings are gone. Saving the project beforehand does not make a difference.

My question is: what is the best way to make these summary strings persist from Xcode session to Xcode session, i.e. have them saved in the project or debug information?

Workaround: I did find out that I can define the summary strings in the ~/.lldbinit file in order to make them persist, and this works. Yet it seems kind of cumbersome, and also is global, not on a per-project basis. I might wish a different summary string for a data type in different projects.


Solution

  • Note that you can also give summaries a category, by using the "-w" option to type summary add. That way you can group related summaries, and turn them all on and off using the "type category {enable/disable}" commands. If you decide to put your summaries in your .lldbinit, you can then use this trick to switch on the ones that are relevant.