2 ms·
Yeah, you're missing out. :) Print statement style debugging can (with effort) get a lot of stuff figured out. But :), it's often fairly slow to go through th
by justinclift 9y ago
Yeah, you're missing out. :)
Print statement style debugging can (with effort) get a lot of stuff figured out.
But :), it's often fairly slow to go through that iteration cycle with non-trivial bugs, compared to using a debugger.
With a debugger, you start from the same place in your code you'd put your print statements. But instead of modifying the code to spit out values, the debugger will pass control of the running program to you. You can then go forwards through your program, seeing how the variable values change, which branches are taken, etc.
It'll get you to the same end result as the print statements, but faster.
Also, for complicated/hairy/weird bugs, being able to follow the actual execution can be enlightening which print statements don't really do.
- zeptomu 9y ago:) Some time ago I did more Java and used Eclipse heavily and its debugger was really nice, so I share your opinion that you get nice features. However if you are working on a project (at least that has been my experience so far) that does a lot of multiprocessing (let's say a web service with a processing scheduler in the background calling into processes implemented by different languages) and you may have bugs on several layers using different programming languages, I like the fact that I can use the same concept for all of them and write some custom "debug.log" that I can later analyze (obviously good logging in the first place can help a lot). But I may check them again: Do modern debuggers work across languages (assuming available source), let's say web-request -> Python -> FFI -> C++? Previously such scenarios have been non-trivial to debug (although there are some pretty advanced multithreaded code analyzers now), but maybe it has changed for the better.
- justinclift 9y ago> But I may check them again: Do modern debuggers work across languages (assuming available source), let's say web-request -> Python -> FFI -> C++? Gah... no idea. I'm still doing mostly doing single language stuff. :D The kind of request path you're mentioning there... yeah, I'd probably go back to using print statements too, as I'd have no idea how to hand off from one language to another in some kind of meta-language-debugger. Which would actually be nifty if it exists.
- pjmlp 9y agoThey do for Java-> C++, .NET -> C++ and Swift->Objective-C->C++.