#How do I run a zig test in gdb?
1 messages · Page 1 of 1 (latest)
I think i'd need zig to write the test executable somewhere, if it does that
maybe that's what "install()" does
use
builder.addTestExe(_, _)
and call its
install()
wait, i can't find my executable
You can run zig test in gdb. I forgot how to pass arguments to executable with gdb, but with lldb it would be lldb zig -- test
@brave ginkgo when i do that, the debugger doesn't know how to analyze the executable, so I can't break on lines in the source code
I think the debugger doesn't know how to analyze the executable, because "source list" results in no output.
Hmmm, maybe zig test forks the test code as seperate process. You can try to insert @breakpoint() in your test code and see if gdb catches it
can try enabling follow on fork mode
\I get "error: the following test command crashed" when it reaches the @breakpoint()
i'll look into the follow on fork mode later
you can do zig test file.zig --test-cmd gdb --test-cmd-bin or zig test file.zig --test-no-exec -femit-bin=file && gdb file
sometimes I just grab the test exe path from the error message and debug that directly
do you know if this behavior is accessible from build.zig?