Question: Consider the following C program: 0 1 int f ( int n ) { 0 2 if ( n = = 1 ) 0 3
Consider the following C program:
int fint n
ifn
return ; this line
return n fn;
int main
int result f;
printfThe factorial of is d
result;
Suppose that the size of each stack frame for procedure f is bytes. Also suppose that immediately before the call to f in main, rsp contains xfffffffdf Provide the contents of rsp immediately before the commented line in f is executed.
rsp contains x
Assume a direct translation to x with no optimizations.
Flag question: Question
Question pts
Suppose that we have disassembled a program and see these two lines at the site of a procedure call:
xf: callq xc
xfb: mov $xeax
Execution of the callq instruction causes address x
to be pushed onto the stack, and address x
to be placed in rip.
Flag question: Question
Question pts
The value of which argument is placed into register rax to prepare for a procedure call?
Group of answer choices
st argument
nd argument
rd argument
th argument
th argument
th argument
none of the above
Flag question: Question
Question pts
Where is the value of a potential th argument placed to prepare for a procedure call?
Group of answer choices
in register rsi
in register r
in memory at the address rsp
in memory at the address rsp
in memory at the address rsp
none of the above
Flag question: Question
Question pts
Consider the following C program:
int pint a int b
return qb aa b;
int qint x int y
return x y;
int main
int result p;
printfThe answer is d
result;
Notice that both p and q use the first two argument registers.
Who is responsible for saving the values of ps two arguments, to ensure that they are available for use after the call to q
Select
Which x operation is used to save the contents of a register?
Select
Which x operation is used to restore the contents of a register?
Select
Flag question: Question
Question pts
What is the exact compiler flag one can use with gcc so that helpful information eg function names, line numbers can be seen when debugging with gdb
Flag question: Question
Question pts
Match the x instruction to where it belongs in a procedure's prolog or epilog.
Group of answer choices
st prolog instruction
Choose
nd prolog instruction
Choose
st epilog instruction
Choose
nd epilog instruction
Choose
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
