|CSC 161||Grinnell College||Spring, 2009|
|Imperative Problem Solving and Data Structures|
This laboratory exercise walks you through the DDD tutorial provided by Gnu. DDD is a graphical debugger DDD (Data Display Debugger), a helpful tool for debugging C programs in a Unix environment.
This lab is an edited version of a DDD tutorial by Marge Coahran. Be sure you have reviewed today's reading before proceeding to the steps that follow.
Follow the instructions in the sample tutorial, except for the exceptions listed below. Stop at the end of the tutorial (i.e., when you run into the sample source code again), which is way before the end of the web page.
ddd sample &
Return to the top of Gnu's tutorial, and scan through it again, this time making a crib sheet of the various DDD features you learned. I suggest recording how the various features are invoked and also brief descriptions of what they do. You may want to keep this crib sheet handy for future use!
Compile the program sample.c again, this time without using the option -gstabs, and try to run it in DDD. (The purpose of this exercise is so that you may recognize the error it produces should you happen to see it again in the future.)
Re-compile sample.c with the debugging information included. Run ddd again. Move the mouse over various icons on the toolbar, and press the F1 key over some of them to read about what they do.
Try selecting What Now? from the Help menu (in the far upper-right corner of the DDD window). You may also want to try the Tip of the Day from the same menu.
Copy or download the following bug-ridden C program: ~walker/c/debugger/debugme.c.
Use what you have learned to track down and fix the bugs in this program with the help of DDD.
You may find the Interrupt button on the DDD Command Tool useful for this exercise. It will suspend your program -- a useful feature for locating infinite loops.
At some point during this exercise, try moving a breakpoint from one line to another by dragging the stopsign icon.
This document is available on the World Wide Web as
created February 2007 by Marge Coahran
restructured 4 May 2008 by Henry M. Walker
last revised 24 January 2009 by Henry M. Walker
|For more information, please contact Henry M. Walker at email@example.com.|