strace - Mitprotokollieren aller Systemaufrufe
Bei der Fehlersuche in Programmen kann das Kommando strace, das jeden Aufruf einer
Systemfunktion mitprotokolliert, wertvolle Dienste leisten. Moechte man sich z. B. alle Aufrufe von
Systemfunktionen beim Ablauf des Kommandos date anzeigen lassen, muss man nur strace date
aufrufen.
Aufrufesyntax
Wird strace ohne die Angabe eines Kommandos aufgerufen, gibt es eine Kurzbeschreibung ueber
seine Aufrufesyntax aus.
1 $ strace
2 usage: strace [-dffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]
3 [-p pid] ... [-s strsize] [-u username] [-E var=val] ...
4 [command [arg ...]]
5 or: strace -c [-e expr] ... [-O overhead] [-S sortby] [-E var=val] ...
6 [command [arg ...]]
7 -c -- count time, calls, and errors for each syscall and report summary
8 -f -- follow forks, -ff -- with output into separate files
9 -F -- attempt to follow vforks, -h -- print help message
10 -i -- print instruction pointer at time of syscall
11 -q -- suppress messages about attaching, detaching, etc.
12 -r -- print relative timestamp, -t -- absolute timestamp, -tt -- with usecs
13 -T -- print time spent in each syscall, -V -- print version
14 -v -- verbose mode: print unabbreviated argv, stat, termio[s], etc. args
15 -x -- print non-ascii strings in hex, -xx -- print all strings in hex
16 -a column -- alignment COLUMN for printing syscall results (default 40)
17 -e expr -- a qualifying expression: option=[!]all or option=[!]val1[,val2]...
18 options: trace, abbrev, verbose, raw, signal, read, or write
19 -o file -- send trace output to FILE instead of stderr
20 -O overhead -- set overhead for tracing syscalls to OVERHEAD usecs
21 -p pid -- trace process with process id PID, may be repeated
22 -s strsize -- limit length of print strings to STRSIZE chars (default 32)
23 -S sortby -- sort syscall counts by: time, calls, name, nothing (default time)
24 -u username -- run command as username handling setuid and/or setgid
25 -E var=val -- put var=val in the environment for command
26 -E var -- remove var from the environment for command
27 $
Eine detailliertere Beschreibung der Optionen ist unter 5.3 Optionen zu
finden.
Zurueck || Index || Vor