strace, breakpoints, etc. Flashcards

1
Q

strace

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

breakpoint

A

set for functions, about to execute a specific instruction, etc. Allows examination of memory, variables, and registers at that point.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
break main
break EchoInput
break <address>
info brekapoints
disable/enable 1
delete 1</address>
A

breakpoint options. May want to add breakpoints at function returns (i.e., line after call) to see return values, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

x/fmt address
ex. x/s argv[1]
print argv[1]

A

examine memory. Format is a number of lines to view plus x for hex, a for address, others.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

disassemble

A

Gives a running disassembly of the function with a pointer for eip.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

x/i <address>
x/5c argv[1]
x/10i address
x/20xw $register</address>

A

Decodes memory contents at address. /xw gives this in hex, /i is a decode to text, /c is characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

c

continue

A

Continue execution after breakpoint to next breakpoint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

stepi

step

A

Per assembly instruction or per code line line stepping. Stepi will step into functions like printf. Both take argument - number of times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

print

A

Gives address of function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly