Tie-in to Lab 2
- Goal: disassemble a small C program and map every stack slot.
- Tasks:
- Identify the prologue and epilogue of each function.
- Locate each local variable's offset (
[rbp-x]). - Set a breakpoint at a prologue and dump
x/16xg $rsp. - Use
btto confirm the caller and the return address. - Draw the frame diagram by hand and verify it against GDB.
- Deliverable: an annotated stack diagram plus your GDB transcript.
Key Takeaway
If you can draw the frame and confirm it in GDB, you understand the function.