Can I attach the debugger to the

Hi everyone :slight_smile: Bet wishes for this new year.

When something goes wrong when building our code, we like to debug it, be it with a debugger or with print statements. But when tests run and fail, they seem to prevent my debug println!() from being executed. I was wondering why has to behave this way.

I’m currenty doing the #IH0 (build you http server) and I’ve got a problem : the first test systematically fails because it does not get what it expected, and the immediate next line I can see “program terminated”, that I more-than-highly suspect of kill9ing our process the very moment a test failed, preventing any “debug print” from appearing in the terminal. Hence, on the one side, I can’t use debug mode (from vscode, lldb) to inspect what’s going on in the tests’ scenario.

But if I juste “Debug” regularly, it simpy launches my executable and waits for any input. Maybe I should also implement a secondary autonomous Client Side, not only to be able to send queries to my program (curl is perfectly ok) but above all to be able to see what actually makes its way (or not) to the client side.

All those words to ask: is it possible (without needing to read bear hexadecimal raw memory, nor necessarily with CLI debug tools, but with vscode debug ui) to be able to break the execution (breakpoint, then gentles steps in, steps over, variable watching, …) of our program WHEN it’s being run and given input by “$ codecrafters test”?

Thank you!

Hi @damien-lucas-dev, unfortunately the answer is no at the moment.

preventing any “debug print” from appearing in the terminal

On the bright side, the absence of logs can also be useful—it indicates that certain parts of the code were not executed.

Although it’s not ideal, aggressive logging can eventually print something meaningful, even if it feels like overkill.