Lab 7: Debugging with gdb

Introduction

In this lab you will practice using the gdb debugger.

Why you should use a debugger

When you run your program within a debugger, you can stop the program at critical points and examine the values of variables and objects. The debugger provides much more capability and flexibility than debugging a program using print statements. For example:

In this lab, we will use gdb, a debugger with a command line interface. Although the user interface is a bit clunky, you will find that gdb has many useful features. It "understands" C and C++ types and syntax, and it works well with source code that is distributed across multiple files.