strace, breakpoints, etc. Flashcards
strace
traces all system calls made by the program. -o for output file. -t for timestamp. -r for relative timestamps. -e to specify comma-separated list of syscalls to view. -p PID to attach to running process. Run as root. -c prints statistics on syscalls.
breakpoint
set for functions, about to execute a specific instruction, etc. Allows examination of memory, variables, and registers at that point.
break main break EchoInput break <address> info brekapoints disable/enable 1 delete 1</address>
breakpoint options. May want to add breakpoints at function returns (i.e., line after call) to see return values, etc.
x/fmt address
ex. x/s argv[1]
print argv[1]
examine memory. Format is a number of lines to view plus x for hex, a for address, others.
disassemble
Gives a running disassembly of the function with a pointer for eip.
x/i <address>
x/5c argv[1]
x/10i address
x/20xw $register</address>
Decodes memory contents at address. /xw gives this in hex, /i is a decode to text, /c is characters.
c
continue
Continue execution after breakpoint to next breakpoint
stepi
step
Per assembly instruction or per code line line stepping. Stepi will step into functions like printf. Both take argument - number of times.
Gives address of function