Hacking LLDB for a great Zig debugging experience
2 days ago
- #Zig
- #Debugging
- #LLDB
- Zig programming language debugging in LLDB is challenging due to unreadable slices, optionals, and error unions.
- zdb is introduced as an LLDB plugin to improve Zig debugging without rebuilding LLDB or using Python scripts.
- The plugin provides readable output for Zig types and enables Zig-like expressions in LLDB.
- zdb works by accessing LLDB's internal APIs, rewriting expressions, and using offset tables for compatibility across LLDB versions.
- Limitations include lack of GUI tree expansion, but CLI expressions work well.
- Comparison shows zdb offers a balance between usability and practicality compared to stock LLDB, Python scripts, and zig-lldb.