Create and attach screen capture of the following c code
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

Create and attach screen capture of the following c code

Problem 3 -Stack Analysis

1. Create and attach screen capture of the following c code. Save it as functA.c


2. Compile it and run it using the debugger    gdb  -q  ./a.out

3. Create break point in main and functA

4. Run it. Use the respective debugger commands to verify main()

a. Locals

b. Arguments

c. Registers rsp and rip addresses 

d. What is the frame size for main function?

5. Use si to step in till functA is called and all arguments are passed. Identify the frame # for main and functA

6. Use the respective debugger commands to verify functA()

a. Locals

b. Arguments

c. Registers rsp and rip addresses 

d. What is the frame size for functA() function?

7. Attach screen capture with identified arguments, local variables, rsp and rbp for main function before calling functA()

8. Use si to step into functA() and identified the instructions that generate variables:local1 and local3. Attach screen capture with identified instructions

9. Use info frame command to find the details of the frame such as rbp address and saved rip which is the return address

10. Use x/40x $rsp to display stack content. Use the results from info frame to identify the return address, rbp and arguments passed. Attach the screen capture with identified result. Use different colors or circle the results othe screen capture 

11. Use si to step into the functA() till it passes return value. What register contains the return value? 

12. What instruction in functA() makes the program to return to main() ?

13. Attach screen capture with identified arguments, local variables, rsp and rbp for functA() function before returns to main ?

14. What is the purpose of the prologue and epilogue? 

15. disas functA   and identify the prologue and epilogue of this function

16. disas main  In the prologue, what is the purpose of the instruction sub ? 

17. Attach screen capture with identified prologue and epilogue for functA()

Hint
Computer1)Computer code, or a set of instructions or a system of rules defined in a specific programming language, is a term used in computer programming (i.e., the source code). It is also the name given to the source code after a compiler has prepared it for computer execution (i.e., the object code)....

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.