Question: ( 5 0 points ) Practice GCC / GDB In this problem, we will use a test C program to demonstrate how to compile, execute

(50 points) Practice GCC/GDB
In this problem, we will use a test C program to demonstrate how to compile, execute and debug a program using GCC compiler and GDB debugger.
Before answering the following questions, please:
Download the "test.c" file from WebCourses.
Make sure you can run GCC and GDB somewhere. For example, you can use:
a. Any UCF servers.
b. A Linux-based machine that has GCC and GDB installed.
c. A virtualization software that runs a Linux distribution on it.
d. Any other services that you can run GCC and GDB on.
Familiarize yourself with running programs in the Terminal.
Once everything is setup, answer the following questions:
Start the Terminal, and run "gdb --version" and "gcc --version" commands. Paste the output of these two commands.
Use "gcc -ggdb3-o test test.c" to compile the test.c file. Paste the output of the command.
Run the "test" program with input "12345". Paste the output of program.
Use GDB to debug the "test" program (you may refer to a GDB cheat sheet), e.g., run "gdb ./test". Then, set breakpoints at main, and line 12 of the program. Start the program with input "12345" and until the breakpoint on line 12 is hit. Copy and paste the GDB output for the above commands.
Use a GDB command to show the assembly of the "test" program. Locate the line of assembly that calls "printf", and paste the five assembly lines before and after the "printf" call. (The test program has two printf calls, and you can choose either one.)
Save all the output of the terminal and upload it to WebCourses.
Test.c code :
( 5 0 points ) Practice GCC / GDB In this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!