🔬 Lab
CS 240 Lab 7
Learning Goals & Reflection
CS 240 Lab 7
Learning Goals
Core Goals
Students can:
- Use gccto compile code.- Look up the meaning of gccflags.
- Use gccto compile C code into assembly code.
- Use gccto compile C code into an executable binary.
- Explain how the -Wall,-std=c99,-S, and-oflags forgccchange its behavior.
 
- Look up the meaning of 
- Use objdumpand/orgdbto disassemble an executable file.- Explain how to use objdumpon a binary file.
- Explain what the three columns of output from objdumpare.
- Explain how to use the disascommand ingdbto disassemble a function.
- Explain What the +numbers in thedisasoutput mean.
 
- Explain how to use 
- Identify and explain core x86 assembly instructions.
- Look up the reference for an unfamiliar assembly instruction and understand what it is saying.
- Explain what the movfamily of instructions does.
- Explain what the j*family of instructions does.
- Explain what the cmp/testfamily of instructions does.
 
- Explain the relationship between assembly code and C code.
- Identify function calls in assembly code.
- Explain how comparison instructions link with conditional jump instructions in assembly code.
- Identify how many parameters a function uses by looking at its assembly code, for functions with up to 6 parameters.
- Identify which line(s) of code in an assembly program set return value(s) for a function.
- Identify conditionals and loops within assembly code.
- Identify which registers are used as pointers in assembly code.
 
- Explain the usage of key x86 registers.
- Explain what the %raxregister is used for in x86 assembly code.
- Explain what the %rdi,%rsi,%rdx,%rcx,%r8, and%r9registers are used for when calling functions in x86 assembly code.
 
- Explain what the 
- Reverse engineer an executable file to figure out what the code is
doing.
- Given a binary file, disassemble it to read the assembly instructions.
- Given assembly code for a function which compares input against a
specific string, use gdbto figure out what that string is, and provide input to manipulate the comparison.
 
Stretch goals
- Identify and explain core x86 assembly instructions.
- Explain what the leainstruction does.
- Explain what the pushandpopinstructions do.
 
- Explain what the 
- Explain the relationship between assembly code and C code.
- Explain how the leainstruction is used in relation to the&operator and also explain its use for general arithmetic.
 
- Explain how the 
- Explain the usage of key x86 registers.
- Explain what the %rspregister is used for in x86 assembly code.
 
- Explain what the 
- Reverse engineer an executable file to figure out what the code is
doing.
- Given assembly code that uses a loop to check relationships among a sequence of numbers, figure out exactly what the loop checks for, and provide a sequence of numbers that will pass the checks.
 
Extra goals
- Explain the usage of key x86 registers.
- Explain what the %rbpregister is used for in x86 assembly code.
 
- Explain what the 
Reflection
Note: Make sure to use the ‘print’ dialog to save this page as a PDF when you’re done.
I’m most confident in (list a few):
I’m least confident in (list a few):
Questions (please take the time to ask at least one, thinking of a question will help you cement what you’ve learned):
