What's New in Swift 5.9 Debugging
Article Summary
Adrian Prantl, Augusto Noronha, and Dave Lee from Apple's Debugger Compiler Integration team just made debugging Swift apps significantly faster. If you're still using the old `p` and `po` commands the same way, you're leaving performance on the table.
Swift 5.9 shipped with three major debugging improvements that change how developers inspect variables and troubleshoot code in LLDB. The updates focus on speed, generic type support, and more accurate variable scoping during debug sessions.
Key Takeaways
- `p` and `po` commands now use faster dwim-print, eliminating persistent result variables
- LLDB now supports generic type parameters in expressions and breakpoint conditions
- Compiler emits precise lexical scopes, preventing display of uninitialized memory
- `po` can now print Swift objects directly from raw memory addresses
Critical Insight
Swift 5.9's debugging improvements make variable inspection faster and more accurate by replacing heavyweight expression evaluation with lightweight alternatives and adding generic type support.