Re:The unreasonable effectiveness of print debugging
by saagarjha on Saturday April 24, 2021 @06:06PM
(#26928569)
Why not just add an action to the conditional breakpoint that prints the value?
Re:The unreasonable effectiveness of print debugging
by sudoit on Monday April 26, 2021 @11:56PM
(#26951840)
I’m usually constructing those values just for that one-off test. They aren’t there at runtime.
It’s an AST interpreter so sometimes I want to see the value of something that’s 5 properties away inside a syntax node
So I tend to write a LOT of print statements that flush of debug variables right before I where I want to debug. Then I set a conditional breakpoint so that I can have the logs "stop" right where I want the program to.
Example:
// debug print
let someValueICareAbout = variable...
print(someValueICareAbout)
print("") <- conditional debug point here "if someValueICareAbout == 3"
I think it's technically still "print debugging", because I'm only using the debugger to stop the program so I get a chance to read my output.