Debugging
Wyn supports source-level debugging with DWARF debug info.
Quick Start
wyn debug app.wynThis compiles your code at -O0 with full debug info and launches lldb.
Setting Breakpoints
(lldb) breakpoint set --file app.wyn --line 5
(lldb) runThe debugger maps machine addresses back to your .wyn source lines.
Inspecting Variables
Once stopped at a breakpoint, inspect local variables:
(lldb) frame variable
(lldb) print my_varWyn variables map to C locals, so lldb can display their values directly. Strings show as wyn_string_t structs — use print my_var->data to see the raw content.
Stepping Through Code
(lldb) step # Step into function calls
(lldb) next # Step over (stay in current function)
(lldb) continue # Run until next breakpoint
(lldb) finish # Run until current function returnsPrint Debugging
For quick debugging without lldb, use println and Log.debug:
Log.debug("processing item: ${item}")
println("count = ${count}")Log.debug includes timestamps and is easy to grep for. Use Log for structured logging in production.
How It Works
When you use wyn debug, the compiler emits C code with #line directives that map back to your .wyn source, then compiles at -O0 -g to produce DWARF debug information:
- Compile unit — your
.wynfilename and directory - Subprograms — each function with line numbers
- Line table — maps machine addresses to source lines
This is the same debug format used by C, C++, Rust, and Swift.
VS Code Integration
The Wyn VS Code extension provides syntax highlighting and basic language support. For debugging in VS Code, configure a launch.json that runs wyn debug with the CodeLLDB extension.
See Also
- CLI Commands —
wyn debug,wyn check,wyn buildreference - Error Handling — Result types and match expressions
- Known Limitations — current debugger limitations
See Also
- CLI Commands — all
wyncommands includingwyn debug - Error Handling — handle errors at compile time
- Known Limitations — current compiler limitations