Question: just answer the ones labeled questions CSC3320 System Level Programming Lab Assignment 8 - In-Lab Purpose: Learn how to use debugger in gdb to debug

just answer the ones labeled questions

just answer the ones labeled questions CSC3320 System Level Programming Lab Assignment8 - In-Lab Purpose: Learn how to use debugger in gdb to

CSC3320 System Level Programming Lab Assignment 8 - In-Lab Purpose: Learn how to use debugger in gdb to debug a program in Unix. Part 1: You are given a C program "q1.c" 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 accordingly. finclude int foo (int num) int rev num 0; for rev num0num > 0num/-10) rev num rev num* 10 + num% 10; return rev num; /* Driver program to test foo int main int num 3302; printf("Result is return 0 %d", foo (num)); 1) Compile "q1.c" with -g option so that we can debug the executable using gdb $gcc- q-g ql.oc 2) Lauch gdb for "q1". $gdb ql 3) List the source code of "q1.c" from line 1 (gdb)list 1 4) Set a breakpoint at the line of statement "for rev_num-0 num >0; num/-10)" uestion: Write your command

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!