Give students an opportunity (or force them) to use GDB and Valgrind. It teaches them how to use important debugging tools, it develops their debugging skills and it improves their code designing skills and code testing skills.

  • Adding points for submitting code with no valgrind errors is good motivation for getting them to use these tools.
  • Adding lab exercises using gdb to find and fix bugs can help get students used to using these tools.
  • When helping students debug their programs, step them through using gdb to help them solve their particular problem. In upper-level courses have them first tell you what they learned from using gdb as the starting point for your helping them further debug their program.
  • In addition, debugging with gdb can give students a look into the way computers function and the structures that a program goes through to run. In systems courses seeing how registers change gives students an opportunity to form connections between high-level programming languages and assembly.
    • Assembly can be confusing, especially in contrast with Python, but it’s important that students have exposure to it as it’s vital aspect of a functioning computer. It gives them an explicit link between their program code and instructions the computer runs.

More about this tip

External Source

Interview with Tia Newhall