LLDB-QuickLook is a debugger command to open images, views, and more using Quick Look. This command is great for inspecting any object that is not well represented by a string in the debugging console. The command is inspired by Xcode's new Quick Look feature, but is better in two ways:
1.) You can inspect any object accessible by an lldb expression, not just objects available in the Xcode GUI. 2.) Any type of object can be inspected by implementing a simple data provider protocol, not just UIImages.
The command is quite simple. It asks an object in your program for debug data, saves the data to a tmp file on your computer, and opens the file using Finder and Quick Look.
.lldbinitfile to your home directory (or append the lines to your existing
.lldbinitfile to match the script's location on your machine.
DataProvidersdirectory to your Xcode project. LLDB-QuickLook requires Xcode 5 or later.
When your program is paused on a breakpoint in lldb, calling the command:
quicklook <object> or
will ask the object for its
quickLookDebugData and save that data to the object's
quickLookFilename. The file will be saved under
/tmp/<target> and opened using Finder + Quick Look. You can make any object into a Quick Look data provider by simply implementing the
quickLookFilename methods. Simple implementations of data providers for
NSString can be found in the
(lldb) quicklook self.imageView.image
(lldb) ql [[UIApplication sharedApplication] keyWindow]
(lldb) quicklook -f some_object.json -- [self jsonString]
(lldb) ql -l self.view
help quicklook from the lldb prompt to see the options for the command.
quicklook uses lldb's powerful (but poorly documented) python scripting bridge. I don't typically write in python, so apologies if I've mixed in some objective-c style conventions. If you have any ideas, comments, or feedback, I'm @ryanolsonk on twitter, and pull requests are welcome!