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()
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.