Aijaz Ansari - Mobile Application team lead at Gogo Business Aviation
Using breakpoint actions you can inject code using the expr LLDB command.
- Add breakpoint
- Edit breakpoint > add debugger action > debugger command
- Add expression:
expr self.myLabel.text = "foo" - Check checkbox to auto-continue if you don't want the debugger to pause.
Note to self: Look into type summary add... command in LLDB. This changes how LLDB reports info. It can be used to make it much more useful.
In your home directory you can create an .lldbinit config file to inject stuff when LLDB starts up. (For example, the type summary add... command.)
LLDB is scriptable with Python.
Using debugger actions tied to breakpoints, you can invoke Python scripts to give custom behaviors to LLDB and do stuff like custom formatting for printing out values of specific types, etc. For example, if you have a complex Swift object, you can use this to create a nice, easily readable print-out value.
Note to self: Check out the JSON parsing tool jq. It's a powerful command line tool to grep and filter through JSON files.
Presenter's repo of Python scripts and .lldbinit can be found at: https://github.com/aijaz/lldbPythonScripts
Lots of good WWDC talks on LLDB and debugging with Xcode as well:
- WWDC 2018: Advanced Debugging with Xcode and LLDB
- WWDC 2017: Debugging with Xcode 9
From the command line, open an .xcodeproj or .xcworkspace file in the current directory:
$ xed .