Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Lab Writeup Stepping through code For this part of the lab, you will be compilin

ID: 3586161 • Letter: L

Question

Lab Writeup Stepping through code For this part of the lab, you will be compiling lab1- 15 2.cpp, which is a basic C+ menu program which contains functions. Copy it to your current directory compile it and invoke gdb with the following sequence of commands cp /home/fac/steve/pub/labl-15_2.cpp - g++ -g - labl-15 2 labl-15_2.cpp gdb labl-152 Note that this time we only gave gdb the executable name since we are not debugging a core dump In the "Edit my submission" portion of Moodle, copy and paste the following questions. Give the gdb command that would accomplish each task AND the output that gdb produced for lab15_2 when you issued that command Assume each command is done one after the other in the order given gdb tasks 1. set a break point at line 50 2. set a break point when the multiply function begins 3. start program execution 4. step through the code by one line 5. step through the code by five lines 6. view your breakpoints 7. clear your first breakpoint 8. list the source code beginning at line 5 9. display the value of the variable in1 10. determine the type of the variable 'c' 11. assign the variable 'in1' the value 3 12. continue program execution after hitting a break point 13. print a trace of the frames in the stack 14. quit the debugger

Explanation / Answer

As you have not provided lab1-15_2cpp,

1. break lab1-15_2cpp:50

2. break multiply

With assumption that function name multiply exist in lab1-15_2.cpp

3. r

4. step

5. step 5

6. info breakpoints

7. delete 1

8. list 5

9. p in1

10. ptype c

11. set var in1 = 3

12. continue

13. f

14 quit