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:
- badprog.c
- 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:
- functions.c: setting breakpoints at functions / examining stack
- loops.c: conditional breakpoints
- memory.c: see the valgrind page and use valgrind to detect the errors in this program.
- 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).