, , , ,

[SOLVED] COP4600 Ex 3-Console Debugging Solved

$25

File Name: COP4600_Ex_3-Console_Debugging_Solved.zip
File Size: 348.54 KB

5/5 - (1 vote)

In most cases, youve written C/C++ code that was definitely broken, and it led to hours of hair pulling, and mundane searching for a simple issue that could have been easily identified by larger scaled debugging tools. Well thanks to GDB, theres less monotony! This exercise will teach you the fundamental, and very powerful tools that the GNU Debugger offers. You will analyze, deconstruct, and debug given programs to help you learn the necessary skills of using a console debugger that will help you with future projects, and any code that you will write. At the end of the exercise, youll submit several annotated screenshots.This exercise will follow this basic structure:Within Reptilian, use the apt-get command to update the Linux package list, and install GDB$ sudo apt update $ sudo apt install gdbTest GDB to make sure that its the correct version by prompting it:$ gdb -versionYour output should look something like this Utilizing the debugger is actually quite simple, in order to start up the debugger on a sample program myProgram we would type:$ gdb myProgramFrom there, we can learn more about GDB and how to use it by keying:(gdb) helpWe highly suggest you reference the bottom link to the GDB manual, and the help command if you ever get stuck, or want to learn more about its features. Using the debugging tool follows a simple guideline that will be outlined below:To run the code, simply key in:(gdb) runThis will run the code as your normal shell would, except it will point out several helpful debugging hints whenever you compile your program with the -g flag.After running the code, you may choose an address, or function name in which you want to place your breakpoint:This will place a breakpoint inside the program at the address of main, and from there, you will be able to step through the code, or run whatever code the method containsThe most useful command next to creating breakpoints, stepping allows the user to step through each line of code to find what the outputs are, and what possible issues the code contains:(gdb) stepAfter stepping through the program, you may delete the breakpoints that are not necessary to youNow that we have learned some basic commands, its time to apply our newfound knowledge to debug some programs that you will make, and that we provideCreate your own Hello World program and play around with the capabilities of GDB. When youre done, take a screenshot of your program being run in GDB with a breakpoint being set in main.Compiling your program uses these commands:$ gcc -o myProggy.o myProggy.c$ gcc -g -o myProggy.o myProggy.cDownload the process.c code from the source folder of the exercise and compile it with the commands given at the bottom of this page. This program emulates a (very) rudimentary process table, however, theres a catch. Inside the program is a bug, and you must use the GDB to find the issue.When youre done, youre going to take a screenshot of the issue in GDB, explain why it broke the code (in a canvas submission comment), fix the code (only one line), and submit another screenshot of the working codes output.To compile process.c$ gcc -w -g -o process process.c -lpthread -lrtDownload the source file password from the same folder as process.c. As you will notice, this file is an output, and it was compiled without debugging symbols. In order to complete this part, you will need to use GDB to find a password that is hidden WITHIN the program itself (you should start by decompiling that code). Look into the info of the program to see what it contains. See if you can track its motion through compilation. You will take a screenshot of where you found the password before decoding it, and the message received after typing in the correct password.Hint: Use a HEX translator, like the one provided at the bottom of the page

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] COP4600 Ex 3-Console Debugging Solved
$25