diff options
Diffstat (limited to 'Completion/Linux/Command/_strace')
-rw-r--r-- | Completion/Linux/Command/_strace | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index 83ccc6afb..7d4595a33 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -19,15 +19,18 @@ _arguments -C -s \ '(-c)-T[show the time spent in system calls]' \ '(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \ '(-x)-xx[print all strings in hexadecimal string format]' \ + '-X+[set the format for printing of named constants and flags]:format:(raw abbrev verbose)' \ '(-c -yy)-y[print paths associated with file descriptor arguments]' \ '(-c -y)-yy[print protocol specific information associated with socket file descriptors]' \ '(-C -i -k -r -ff -t -tt -ttt -T -y -yy)-c[count time, calls, and errors for each system call and report a summary]' \ '(-c)-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ '-O+[overhead for tracing system calls]:overhead (microseconds)' \ - '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort criterion:(time calls name nothing)' \ + '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort criterion [time]:(time calls errors name nothing)' \ '-w[summarise syscall latency]' \ '*-e+[select events to trace or how to trace]:system call:->expressions' \ '*-P+[trace only system calls accessing given path]:path:_files' \ + '(-Z)-z[trace only system calls that return success]' \ + '(-z)-Z[trace only system calls that return an error]' \ '-b+[detach from process on specified syscall]:syscall:(execve)' \ '-f[trace child processes as they are created by currently traced processes]' \ '(-c -C)-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \ @@ -36,6 +39,7 @@ _arguments -C -s \ '*-E+[set or remove exported environment variable]:variable:->envars' \ "${root}-u+[run as specified user]:user:_users" \ '(:)*-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ + '--seccomp-bpf[enable seccomp-bpf filtering]' \ '-d[show debug output of strace itself on standard error]' \ '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \ '(- 1 *)-h[display help information]' \ @@ -56,25 +60,44 @@ case $state in 'write[perform a full hex and ASCII dump of all the data written to listed file descriptors]:file descriptor:_sequence _file_descriptors' \ 'fault[perform syscall fault injection]:system call:_sys_calls -a -n' \ 'inject[perform syscall tampering]:system call:_sys_calls -a -n' \ + 'status[trace system calls with given return status]:status:->status' \ 'kvm[print the exit reason of kvm vcpu]: :(vcpu)' && ret=0 - if [[ $words[CURRENT] != *=* || $state = syscalls ]]; then + if [[ $state = status ]]; then + _values -s , 'return status [all]' \ + all successful failed \ + "unfinished[system calls that don't return]" \ + 'unavailable[system calls that return but strace fails to fetch the error]' \ + 'detached[system calls where strace detaches before the return]' && ret=0 + elif [[ $words[CURRENT] != *=* || $state = syscalls ]]; then local dedup sets suf="-qS," compset -P '!' dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} ) compset -S ',*' || suf="" compset -P '*,' - sets=( - 'file:trace all system calls which take a file name as an argument' - 'process:trace all system calls which involve process management' - 'network:trace all the network related system calls' - 'signal:trace all signal related system calls' - 'ipc:trace all IPC related system calls' - 'desc:trace all file descriptor related system calls' - 'memory:trace all memory mapping related system calls' - ) - _alternative \ - "related system call:sets: _describe -t traces 'related system call' sets -F dedup $suf" \ - "system call:syscalls:_sys_calls -a -n $suf -F dedup" && ret=0 + if compset -P /; then + _wanted syscalls expl "system call (regex)" _sys_calls -a -n $suf -F dedup && ret=0 + else + sets=( + {%,}'file:trace all system calls which take a file name as an argument' + {%,}'process:trace all system calls which involve process management' + {%net,{%,}network}':trace all the network related system calls' + {%,}'signal:trace all signal related system calls' + {%,}'ipc:trace all IPC related system calls' + {%,}'desc:trace all file descriptor related system calls' + {%,}'memory:trace all memory mapping related system calls' + '%stat:trace variants of stat' + '%lstat:trace variants of lstat' + '%fstat:trace variants of fstat and fstatat' + '%%stat:trace variants of all syscalls used for requesting file status' + '%statfs:trace variants of statfs' + '%fstatfs:trace variants of fstatfs' + '%%statfs:trace variants of all syscalls used for file system statistics' + '%pure:trace syscalls that always succeed and have no arguments' + ) + _alternative \ + "sets:related system call: _describe -t traces 'related system call' sets -F dedup $suf" \ + "syscalls:system call:_sys_calls -a -n $suf -F dedup" && ret=0 + fi fi ;; file-pipe) |