Main navigation | Main content
Like the previous lab, This lab focuses on debugging a simpler version of the
the binary bomb (hands on assignment 3). This will all be done using the GDB
debugger. This will allow you to step through the code line by line, print
out the contents of variables and registers, and set break points in the
program. The way this "bomb" works is by reading in your input from a text
file. You will type your input(s) for each "phase" on separate lines in the
provided text file, input.txt. You can then run the executable "puzzle"
against your input using the command:
./puzzle input.txt
This will most likely provide less than satisfactory results until some
debugging is done on the executable to try and decode the correct inputs. This
will be done using GDB.
A more realistic code example called warmup is also provided. There is a
segfault somehwere in the program. You may be able to find it by
inspection, but also experiment setting watchpoints and exploring the data
structures. On that note, play with the
(gdb) explore EXPRESSION
command. For more details about explore, read the documentation:
https://sourceware.org/gdb/current/onlinedocs/gdb/Data.html
(NOTE: I observe this to hang gdb if a layout is active).
To get the puzzle program to use in lab, run the command:
cp /web/classes/Fall-2018/csci2021-010/labs/0x6/{puzzle,input.txt,warmup} .
The program itself will take a .txt file named "input.txt" as an argument. In the input file,
you will have to debug the program to find the solutions to each phase and place those solutions
into the text file.
When you input your solutions in the text file, make sure you do it one
line at a time, with no extra spaces at the end of the line, or the file
could be misread. If you figure out all of the solutions and receive the
final output of the puzzle program, you have completed the lab and are on
your way to debugging the fabled binary bomb.