How To Use a Debugger (In Depth Tutorial)

I remember when I was in university, my professor was teaching us how to use a debugger, and the debugger that he was showing us was GDB. GDB is a debugger that you can use with C. With this debugger, he was talking about breakpoints, pausing the program, and then continuing the program and looking at different values of your variables.

To me, it was just really confusing, and I didn’t really want to debug my code that way. I would rather just debug my code using print statements to see the values of variables as I’m running the program normally. I didn’t really see the value of using it, and I wasn’t really taught how to use it.

But then, when I went to my first job, we were coding in C++ with Visual Studio and Java with Eclipse. I didn’t have any experience in these programming languages at that time, but using the debugger really helped me as I was learning how to code in those languages and fixing bugs.

The codebases I was given were really complex, so it was hard to put print statements here and there to figure out how the program was working. My supervisor just told me to use the debuggers.

So, my supervisor sat next to me and spent some time showing me how to use the debugger with those IDEs. Once I learned how to use the debugger for those IDEs, I couldn’t go back, and that’s how I was able to make a lot of contributions to our product at that time.

Fast forward to my second job, they asked me to code in C#, and I had no experience coding in C#, but we were using Visual Studio. So I used the debugger in Visual Studio to familiarize myself with how C# works, and I was able to maintain our codebase with Visual Studio and the debugger. Moving on to other projects, I continued to use different debuggers for different IDEs to continue learning and fixing our codebases.

Thank you for watching, and happy coding! 💻🧡
-Henrik