From 52f46cca751cc40db978b88dd6379866cad30b15 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 17 Jul 2016 12:32:02 +0200 Subject: 38867: update strace completion Also factor out completion for system calls and new functions for truss and ltrace. --- Completion/Linux/Command/_ltrace | 35 +++++++ Completion/Linux/Command/_strace | 210 ++++++++++++++++++--------------------- 2 files changed, 131 insertions(+), 114 deletions(-) create mode 100644 Completion/Linux/Command/_ltrace (limited to 'Completion/Linux/Command') diff --git a/Completion/Linux/Command/_ltrace b/Completion/Linux/Command/_ltrace new file mode 100644 index 000000000..e48d8ec98 --- /dev/null +++ b/Completion/Linux/Command/_ltrace @@ -0,0 +1,35 @@ +#compdef ltrace + +local root hlp="-h --help -V --version" + +(( EUID )) && root='!' + +_arguments -s -S $args \ + "(-c -a --align $hlp)"{-a+,--align=}"[align return values in a secific column]:column [$((COLUMNS*5/8))]" \ + "(-c $hlp)-A+[specify maximum number of array elements to print]:elements" \ + "(-c -b --no-signals $hlp)"{-b,--no-signals}"[don't print signals]" \ + "(-a --align -A -b --no-signals -i -n --indent -r -s -t -tt -ttt -T $hlp)-c[count time and calls, and report a summary on exit]" \ + "(-C --demangle $hlp)"{-C,--demangle}'[decode low-level symbol names into user-level names]' \ + "(-D --debug $hlp)"{-D+,--debug=}'[enable debugging]:mask:(help 77)' \ + "($hlp)*-e+[modify which library calls to trace]:filter" \ + "($hlp)-f[trace child processes]" \ + "($hlp)*"{-F+,--config=}'[load alternate configuration file]:file:_files' \ + '(- 1 *)'{-h,--help}'[display help information]' \ + "(-c $hlp)-i[print instruction pointer at time of call]" \ + "(-l --library $hlp)"{-l+,--library=}'[only trace symbols implemented by specified library]:library:_files' \ + "($hlp)-L[don't display library calls]" \ + "(-c -n --indent $hlp)"{-n+,--indent=}'[specify indent for each level of call nesting]:spaces' \ + "(-o --output $hlp)"{-o+,--output=}'[write the trace output to specified file]:file:_files' \ + "(: $hlp)-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids" \ + "(-c $hlp)-r[print relative timestamps]" \ + "(-c $hlp)-s+[specify the maximum string size to print]:maximum string size [32]" \ + "($hlp)-S[trace system calls as well as library calls]" \ + "(-c -ttt $hlp)-t[prefix each line of the trace with the time of day]" \ + "(-c -ttt -tt $hlp)-tt[prefix each line of the trace with the time of day including the microseconds]" \ + "(-c -tt -t $hlp)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]" \ + "(-c $hlp)-T[show the time spent in each call]" \ + "${root}-u+[run as specified user]:user:_users" \ + '(- 1 *)'{-V,--version}'[display version information]' \ + "($hlp)*-x+[modify which static functions to trace]:filter" \ + '(-):command name: _command_names -e' \ + '*::arguments:_normal' diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index d6dabfd24..cbf95d6c4 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -1,119 +1,101 @@ -#compdef strace +#compdef strace strace64 -# TODO: -# - make _sys_calls system-dependent -# - allow negated calls (e.g. -e!write) -_sys_calls () { - local expl - local -a sys_calls +local curcontext="$curcontext" state line root expl ret=1 +typeset -A opt_args - sys_calls=(_llseek _newselect _sysctl accept access acct - adjtimex afs_syscall alarm bdflush bind break brk cacheflush - capget capset chdir chmod chown chown32 chroot clone close connect - creat create_module delete_module dup dup2 execve exit fchdir - fchmod fchown fchown32 fcntl fcntl64 fdatasync flock fork fstat - fstat64 fstatfs fsync ftime ftruncate ftruncate64 get_kernel_syms - getcwd getdents getdents64 getegid getegid32 geteuid geteuid32 - getgid getgid32 getgroups getgroups32 getitimer getpagesize getpeername - getpmsg getpgid getpgrp getpid getppid getpriority getresgid getresgid32 - getresuid getresuid