Feb 11
We'll continue to explore the chapter 3 (assembler)
material in whatever way seems helpful.
One idea:
- Code a recursive fibonnaci C program.
- Examine closely with gdb :
- make a memory map of what's where
- step through the program, watching procedure calls & registers & all that
- ... looking up everything we need.
Or another idea:
GDB resources:
Note that there are two choices for assembly , IA32 and x86-64.
- Older version of the text (and the course) used IA32. Our version uses x86-64.
- See http://csapp.cs.cmu.edu/3e/waside/waside-ia32.pdf for a discussion.
- Older IA32 used frame pointers. Newer ones don't. x86-64 typically does not.
- gcc compiler options : -m32 (i.e. generate IA32) , -m64 (i.e. generate x86-64)
IA32 x86-64
--------- ------------
4bytes 8bytes addresses (and thus pointer size)
8 16 registers
%e... %r register names
%esp %rsp stack pointer
%ebp %rbp frame pointer (if used)
on stack registers(6) function args
leal leaq load effective address
stack registers local variables
Cute trick for x86 registers for procedure arguments :
Diane's silk dress costs $89.
http://csappbook.blogspot.com/2015/08/dianes-silk-dress-costs-89.html
CMU powerpoint slides
what we did
I wrote a fib.c file and started to create a
description of what lived where in memory
(what I think of as a "memory map"),
working within gdb to examine registers
and the stack as we stepped through code.
On csmarlboro.org I also installed gcc-multilib
(better 64 bit support) and gdb64 (gdb there
is 32bit).
See the attached files.