Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 655
DonCristobal Avatar asked Oct 20 '22 17:10

DonCristobal


2 Answers

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.

like image 68
Jim Ingham Avatar answered Oct 23 '22 09:10

Jim Ingham


You could define these formatters in a file in your project, then make a breakpoint on your app's main(), and associate to it debugger command actions to "command source myFile" and automatically continue

That should do the magic

like image 31
Enrico Granata Avatar answered Oct 23 '22 10:10

Enrico Granata