Lab Assignment--Compile and Debug

Part 1--A Linked List Project

  1. Copy three files using the following command
    cp /net/data/ftp/pub/class/330/CompileDebug/Exercise/* .
  2. Write the Makefile for the Linked List program. Do not forget the options to debug the program later. Define variables for the object files, compiler name, preprocesor, compile and link options. Note that options that are not needed at this time can be defined as null values. eg. CPPFLAGS = . Do not forget the options to debug the program later.
  3. In addition to the targets referred to in the notes, large projects (like the one your class project is becoming) typically have targets for install: and uninstall:. Create these targets.
  4. Run the program. Try inserting numbers into the linked list and printing the resulting list.
  5. Insert a 0 into the list, you will get a segmentation fault (core dump). Remember to remove the core file.
  6. Use gdb to debug the program.
  7. Use strace to show the system call in your program.

Part 2--Your CS330 Project

However much you may wish that your project were a simple linked list, it isn't. It should be split up into components and span several files. Compiling, debugging and testing will be much easier if you take the time to create a Makefile for your project. Do this as soon as possible.