Version: 1.1.0
Debugging
Mojo programs debug with prints, assertions, and the LLDB-based mojo debug flow.
Essentials
printof intermediate values is still the fastest first step.comptime assertcatches mistakes before a binary exists.mojo debug file.mojolaunches the debugger.- The VS Code extension can drive the same debugger.
- Optimize after the values are right. Inlined kernels are harder to step through.
Example
$ mojo debug hello.mojo
Keep in mind
When a GPU kernel misbehaves, first run the same math on the CPU. Most index bugs show up there.