CS 33: Using gdb and valgrind

CS 33: Computer Organization

December 4, 2008

Using gdb and valgrind

This page has some basic information about today's in-class lab.


First, follow through the examples on this page and step through these two programs:
  1. badprog.c
  2. seqfaulter.c
These files are already available in your cs33/class/12-04-Th/ directory. A Makefile is also provided.
After you have stepped through (and understood) the two programs above, try debugging each of these files. The comment at the top of each file explains what you should do:
  1. functions.c: setting breakpoints at functions / examining stack
  2. loops.c: conditional breakpoints
  3. memory.c: see the valgrind page and use valgrind to detect the errors in this program.
  4. infiniteloop.c: attaching to a running process / valgrind

Now that you have used valgrind in the infiniteloop.c program, run your id3 program through valgrind and be sure you had no memory leaks.

On the suffix tree lab, you are required to have no memory leaks (as reported by valgrind).