Strace

From aldeid
Jump to navigation Jump to search

Description

Trace system calls and signals.

Usage

Syntax

usage: strace [-CdffhiqrtttTvVxxy] [-I n] [-e expr]...
             [-a column] [-o file] [-s strsize] [-P path]...
             -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]
   or: strace -c[df] [-I n] [-e expr]... [-O overhead] [-S sortby]
             -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]

Options

-c
count time, calls, and errors for each syscall and report summary
-C
like -c but also print regular output
-w
summarise syscall latency (default is system time)
-d
enable debug output to stderr
-D
run tracer process as a detached grandchild, not as parent
-f
follow forks, -ff -- with output into separate files
-i
print instruction pointer at time of syscall
-q
suppress messages about attaching, detaching, etc.
-r
print relative timestamp, -t -- absolute timestamp, -tt -- with usecs
-T
print time spent in each syscall
-v
verbose mode: print unabbreviated argv, stat, termios, etc. args
-x
print non-ascii strings in hex, -xx -- print all strings in hex
-y
print paths associated with file descriptor arguments
-h
print help message, -V -- print version
-a column
alignment COLUMN for printing syscall results (default 40)
-b execve
detach on this syscall
-e expr
a qualifying expression: option=[!]all or option=[!]val1[,val2]...
options: trace, abbrev, verbose, raw, signal, read, write
-I interruptible
1: no signals are blocked
2: fatal signals are blocked while decoding syscall (default)
3: fatal signals are always blocked (default if '-o FILE PROG')
4: fatal signals and SIGTSTP (^Z) are always blocked (useful to make 'strace -o FILE PROG' not stop on ^Z)
-o file
send trace output to FILE instead of stderr
-O overhead
set overhead for tracing syscalls to OVERHEAD usecs
-p pid
trace process with process id PID, may be repeated
-s strsize
limit length of print strings to STRSIZE chars (default 32)
-S sortby
sort syscall counts by: time, calls, name, nothing (default time)
-u username
run command as username handling setuid and/or setgid
-E var=val
put var=val in the environment for command
-E var
remove var from the environment for command
-P path
trace accesses to path

Comments

Keywords: strace