Question: c++ 2. Debug the following program using the GNU DeBugger tool (GDB). 3 Assignment Requirements: - Write the program in the text editor of your

c++ c++ 2. Debug the following program using the GNU DeBugger tool (GDB).3 Assignment Requirements: - Write the program in the text editor ofyour choice. - Type the program in as given. Do not make

2. Debug the following program using the GNU DeBugger tool (GDB). 3 Assignment Requirements: - Write the program in the text editor of your choice. - Type the program in as given. Do not make any changes. - With one exception: type your first and last name where it says - Save the file with the name hw5gdb.c. - Upload the C file to Zeus using an SFTP client (e.g. FileZilla). - Log into Zeus using an SSH client (e.g. PowerShell, PuTTy, or the terminal window). - Compile the program using the following command: - Run the program using the command: A hw 5gdb Expected output: z=0z=1z=2z=98z=99 Did the program produce the correct output? Why not? Time to debug your program. It goes to 9 oflxgdb. - Start GDB using the following command: hw5gdlo - Set a breakpoint at the beginning of the main function using the command: break main - Run the program (to the first breakpoint) using the command - Single-step to the next instruction using the command next - Print the values of variables x,y, and z using the commands print x print y prrint z What are the values of the variables? Do the values make sense? - List your program using the commands (yes, type list twice) - Continue program execution to the breakpoint at line 14 using the command listlist - Print the values of variables x,y, and z using the commands - List lines 8-14 of your program using the command print x print y print z - Set a breakpoint at line 14 using the command What are the values of the variables? Do the values make sense? break 14 - Continue program execution to the breakpoint at line 14 using the command continue - Print the values of variables x,y, and z using the commands - Print the values of variables x,y, and z using the commands print x \begin{tabular}{ll|l|l|l|} print x & print \\ print y & print & z \\ print z & \end{tabular} What are the values of the variables? Do the values make sense? What are the values of the variables? Do the values make sense? What is wrong with the program? - Single-step to the next instruction using the command - Take a screenshot using Alt-F10 (prtsc). Note: the screen shot should include the values of x,y, and z, both before and after the instruction at line 14 is executed. - Print the values of variables x,y, and z using the commands print x print y print z What are the values of the variables? Do the values make sense? Submit your screenshot as part of your homework solutions

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 Databases Questions!