CS208 Introduction to Computer Systems Monday, 27 October 2025 + Today - zoo and gdb questions - zoo and gdb work time + Questions rax points to Jeff's input string -- before call phase_2 rsp = 0x7fffffffe980 rip = 0x400da5 address of the instruction after "call phase_2" is 0x400daa address of phase_2 0x400e8e + My zoo workflow - list and break - run: "r passcodes.txt" - step into phase - watch the stack - think about each instruction before stepping over it - check the results after each instruction - watch for the cmp/jx and test/jx behavior before jumping to "trigger_alarm" + gdb techniques summary - run the program - with no command-line arguments ("r") - with command-line arguments ("r passcodes.txt") - start over ("r" or "r passcodes.txt" and say yes) - view assembly language ("layout asm") - fix the display after output (Ctrl-L) - set a breakpoint ("br 57", "br *0x401c94") - step through the code - next instruction ("nexti" or "ni") - step into ("stepi" or "si") - continue ("c") - look at all registers ("info reg" or "i r") - look at specific registers ("i r rsp,rip,eax") - look at memory contents - as a null-terminated string ("x/s 0x41238c") - as a sequence of bytes ("x/32bx 0x41238c" -- b=byte, x=hex) - as a sequence of ints ("x/20wx 0x41238c" -- w=word=4-byte chunks) - as a sequence of addresses ("x/20gx 0x41238c" -- g=giant=8-byte chunks) - ...and interpreting what you see - look at the memory pointed to by a register ("x/20wx $rsp") - go slowly! + Work time