A very general question, but I want to make sure I am getting into good habits with debugging. I'm currently starting pset5 speller and keep seeing comments about running the "gdb debugger" but I'm not sure exactly what it is. Unless I missed something the lectures have only mentioned to use the debug50 in the CS50 IDE (I am doing the course via EDX online). The main thing I would like to know is is it good practise to use both or is one superior to the other going forward? I know I am also going to have to use Valgrind so does one make more sense when using that also? I can't see any related questions here, but if anyone has any guidance or links to explanations on the difference that would be much appreciated.


Here is a CS50 short on gdb. debug50 is essentially a GUI wrapper for gdb. As Doug mentions, if you are not in a CS50 IDE environment, it would be the goto for debugging.

valgrind will basically tell you where to look for problems (memory leaks) in the code. It really shouldn't matter which debugger you use to track down such problems.

IMO it is never a bad idea to have multiple tools in your toolbox, but should you find yourself without debug50, you will surely miss it.

Here is the GNU documentation on gdb.

  • Many thanks for the info I managed to miss that short somehow! – James Apr 29 '19 at 20:29

It depends on who you ask you will tell you one thing or another, as far as their differences, apart from the obvious, at an elementary level they do practically the same thing. Regarding my preferences I prefer gdb from the command line. It is not wrong to learn gdb from the command line, in some debugging environments it may be the only tool available.

  • Many thanks I am practising a little with it now in the command line! – James Apr 29 '19 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .