In Chapter 2 of Introduction to Zig, I learned how I could compile a binary and then use lldb to debug my Zig program.
But when working on Exercism exercises, I don’t know how to apply that knowledge and still use std.debug.print, any idea how I can do something like byebug in Ruby or set_trace in Python?
When testing an executable is compiled, it’s just in the global or local cache, so it is hard to find.
Fortunately, when a test fails the path to the executable is printed, though it is hard to see among all the other information.
If that’s too annoying you can ask zig to output it somewhere more convenient, by installing the artifact in the build system, or using the -femit-bin=path if using the cli.
2 Likes