pete > courses > CS 202 Spring 24 > Tier 2, Phase 2, Problem 04: Stack Size


Tier 2, Phase 2, Problem 04: Stack Size

The goals of this problem are to solidify your knowledge and understanding of The Stack and to get you practice using gdb. It is much different in style than previous assignments: you will not be building a computational thing (like a circuit or a program) to specification; instead, you have questions to answer and will have to devise a program that helps you answer them.

These are the questions you must answer:

You will write a program that, when run within gdb, allows you to answer these questions. That is, your answers will come from a combination of the program you write and commands you run within gdb while the program is running.

You will submit two files for this assignment:

You will find this gdb guide handy.

Reminders about x86

Since you will be compiling and running your program (with gdb) on weathertop, you will be working with x86 code. The principles of how The Stack operates are the same as with ARM32, though the registers will have different names and memory addresses will be 64-bits (8 bytes) rather than the 32-bit addresses used by ARM32.

This table shows the special-purpose registers we have covered in ARM32 and their x86 equivalents:

purpose ARM x86
stack pointer SP rsp
frame pointer FP rbp
program counter PC rip
link register LR n/a

Submission Instructions

Copy the stack-size.c and README.txt files to weathertop and then run:

$ 202 submit t2p2p04 stack-size.c
$ 202 submit t2p2p04 README.txt

Submissions will not be accepted after 2pm on Friday, 10 May.

Last modified: