(Lecure Notes are now available too.)
Here are some slides I used for a one hour lab I taught to computer science undergraduates in 1994. It was the first year the students had used C but they were expected to understand the basics of the language by the time this lecture was given. The slides, and accompanying lecture, had been adapted from a similar lecture I gave about debugging Pascal to an advanced first-year programming class a couple of years earlier.
The slides were accompanied by print outs of some of the programs they include. Students were able to view and print the slides a week before the lab, but they only got the printout (and the lecture) if they attended the lab. On their own the advice on the slides seems rather trite to me, but when they was combined with my anecdotes about my own experiences I felt it was quite effective. The students in both classes certainly seemed to appreciate the advice.
The 10 letter-sized slides are in a (136K) PostScript® file. They are the original slides I used, except that I have included an explicit copyright notice at the bottom of each page. A slightly updated version (in HTML) is also available.
I wrote these notes for a specific software environment so some of the notes about using the debugging program may not apply anymore. I have left them in the HTML version because I think my selection of commands is a clear indication of how modern debuggers should also be used.
When I wrote the notes I didn't understand C as well as I do now
(not that I'm an expert). I know now that my use of
string is declared as
* string) does not work as I intended. I think that I told the
students how to use it properly at the time (it was a great excuse to
explain a difference between arrays and pointers) but I am not certain. I
know that Steve Summit addresses this point in questions 11.11 and 11.9 of
his book C Programming FAQs If you don't understand the problem
then I suggest you check out the book. The posted list includes question 11.9 but not 11.11.
Please inform me (preferably by e-mail) if you find any other errors in my examples.
If you find the slides even slightly interesting then I think you will be interested in my other advice for C programmers. I especially think my list of recommended reading and collected debugging wisdom of others will help anyone struggling to debug C programs.
Elsewhere, the undergraduate computer science laboratory at CalTech has some other notes about debugging (written by Dan Egnor, Dan Frumin and Jon Lange). I have a local copy of those notes (snarfed and slightly touched up on 20 May 1996). Norm Matloff has tutorial about using a debugger that goes into more specific details than my notes do. The ACM website has HTML versions of some classic papers that originally appeared in ACM publications. Of particular interest to readers of these notes are
The April 1997 edition (vol. 40, no. 4) of Communications of the ACM contained several articles about `the debugging scandal'. Of particular interest to students is My Hairiest Bug War Stories by Marc Eisenstadt on pages 30 to 37.
Last updated by J. Blustein on 16 January 2005 (immediately previous versions were 12 April 2002, and 2 June 1996).
This document is copyright by its author, J. Blustein <firstname.lastname@example.org>.