Tie-In to Lab 2
Lab 2: Reading Your First Disassembly
- Compile a small C program and disassemble it in both GDB and Ghidra.
- Switch GDB to Intel:
set disassembly-flavor intel. - Identify: the prologue/epilogue, argument registers, an
if, and a loop back-edge. - Map each C statement to its assembly lines.
// Compile with frame pointers so RBP-relative locals are visible:
// gcc -O0 -fno-omit-frame-pointer -o lab2 lab2.c
Key Takeaway
Reading assembly is a skill built by doing. Start with -O0 code, then work up to optimized and obfuscated binaries.