I’ve been programming for about 5 months now. I started with C++ then C and finally Java. In this time I have never used the debugging feature on my compilers, nor do I know what it does. In class I have been taught nothing about the debugger so far (Altho class is barely starting in C, I learned C++ and Java on my own). What is debugging, what does it do and do you use it often? What are the uses for debugging? I’ve googled debugging, but I couldn’t quite understand. Can anyone explain the debugging feature properly? From what I understand so far, it’s a feature to help you find bugs, but I don’t quite get how it works.
Share
Debugging itself is the process of finding and exterminating bugs, nothing more and nothing less. So unless you’re a perfect programmer who never makes any mistakes, you’ve done it.
A debugger, on the other hand, is a tool which assists in debugging. You can still debug without a debugger, but using a debugger gives you more options, and ways to go about it.
Without you mentioning specifically which debugger you’re talking about (Visual Studio one, or gdb, or…) we can’t really tell you how to use it, but, in a nutshell:
A debugger will let you execute the code one instruction at a time, or one line at a time. It will let you run your code until a place you’re interested in, then stop. While the code is stopped, you can inspect the values of the variables to make sure things are in order, and in some cases even modify things on the run to test various scenarios.
Some of the techniques of debugging without using a debugger are:
and many more.