Question: Part 1: You are given a C program qle as below. But since there are no enough comments in the program, it is hard to
Part 1: You are given a C program "qle as below. But since there are no enough comments in the program, it is hard to find out the feature of the function foo. So let us trace the execution of the program and find out what foo does. Please follow the steps below and answer the questions accordingy int rw n- Deiver progrsn to test toe "/ int nun-3302 1) Compile qLe with -E option so that we can debug the executable using edb. 2) Lauch gdb for "q1". gdbgl 3) List the source code of "qle trom line 1. (gdb)list 1 4) Set a breakpoint at the line of statement "for ( re.num = 0 ; num > 0 ; num/= 10). Question: Write your command 4) Run the program until the first breakpoint. Question: w S) Use display to show the value of rev num and num at each time when program stops gdb)display evnum (gdb) display 6) Run the for loop step by step using command n multiple times. gdb) n Question; check the value of rev num and num ofter each iteration and fill in the table below 7) When the program terminates, quit gdb using command q gdb)q 8)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
