Please show your completed text file to your TA by the end of section for credit.
What is GDB?
GDB is the GNU project debugger. Some of its functionalities include the following:
-
Starting your program, specifying anything that might affect its behavior
-
Making your program stop on specified conditions
-
Examining what has happened when your program has stopped
-
Changing things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.
Learning how to use GDB effectively will be very important to you later on in this course, particularly for the final project.
To teach you to use this tool, you'll be debugging a selection sort implementation. You are already familiar with selection sort, as
you implemented it in the previous lab, so we hope that you can focus your time on learning GDB.
-
Make sure you're using the VM or SSH environment we provide for you! This is one of those assignments that may perform differently
on different systems.
-
Retrieve the lab9 files from Github with
git pull
in your CS 3410 Github repository. There is a helpful GDB document/cheatsheet in your repos.
How to Run
Compile using the following command: gcc -std=c99 -g -o lab9 buggy_sort.c
Run the program using the following command(s): ./lab9
or gdb ./lab9
Entering GDB Mode
There are 4 bugs in buggy_sort.c
, find them all and document how you found them using GDB.
Check Off
Be sure to demonstrate to your TA that you understand all the bugs in the code by providing explanations in your text file. These explanations should include a description of the bug and how you used gdb to find it (commands).