Logged in as: guest Log in | |||||||
Home | Research | Courses | Publications | ||||
Recursion, Debugging, and Stack DumpsOctober 23, 2015Prelab (complete before lab)This Lab introduces the gdb debugger. It assumes that you are familiar with the use of pointers, and that you already know how to compile and execute a program. To illustrate debugging principles we will use an example buggy program. Each bug is documented with an associated comment. As you progress through the lab, you will use the debugger to locate and fix each one. The buggy program can be downloaded here. The code is very simple and consists of three functions and the declaration and initialization of a binary tree. Prior to the lab download the program, compile, and run it. The program will print out some messages, indicate a segmentation fault, and then crash. Given only the output information, it is near impossible to determine why the program crashed, much less how to fix it. You should get a result similar to the following:
Next, fix the bugs as indicated in the comments, compile, and rerun it. This time you should get:
Make sure that you revert your code to the original buggy version before starting the lab. Part 1: |