From d5fec6b512c1d588a5a3dee27226b870a3fe3363 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 12 Nov 2018 10:32:41 +0100 Subject: 43816: various completion option updates --- Completion/Linux/Command/_ethtool | 12 ++- Completion/Linux/Command/_losetup | 3 +- Completion/Linux/Command/_lsblk | 1 + Completion/Linux/Command/_valgrind | 189 ++++++++++++++++++++++++++++--------- 4 files changed, 153 insertions(+), 52 deletions(-) (limited to 'Completion/Linux') diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool index 84f2837a8..33b7681dc 100644 --- a/Completion/Linux/Command/_ethtool +++ b/Completion/Linux/Command/_ethtool @@ -106,6 +106,7 @@ if [[ -n $state ]]; then '(d)a[wake on ARP]' \ '(d)g[wake on MagicPacket(tm)]' \ '(d)s[enable SecureOn(tm) password for MagicPacket(tm)]' \ + '(d)f[wake on filter(s)]' \ '(p u m b a g s)d[disable (wake on nothing)]' ;; sopass) @@ -138,9 +139,6 @@ if [[ -n $state ]]; then flags) _message -e masks mask ;; - encoding) - _wanted encodings expl encoding compadd auto off rs baser - ;; context) _message -e contexts 'RSS context' ;; @@ -255,7 +253,7 @@ if [[ -n $state ]]; then hkey hfunc delete ;; -f|--flash) - if (( CURRENT = 4 )); then + if (( CURRENT == 4 )); then _files else _message -e regions region @@ -291,7 +289,11 @@ if [[ -n $state ]]; then {mgmt,irq,dma,filter,offload,mac,phy,ram,ap}{,-shared} ;; --set-fec) - _wanted options expl tunable compadd -F line - encoding + if (( CURRENT == 4 )); then + _wanted options expl tunable compadd - encoding + else + _wanted encodings expl encoding compadd -F line auto off rs baser + fi ;; esac ;; diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup index 9cfaaf5bf..d826e8d51 100644 --- a/Completion/Linux/Command/_losetup +++ b/Completion/Linux/Command/_losetup @@ -18,7 +18,8 @@ _arguments -s -S \ - 'info' \ '(-v --verbose)'{-v,--verbose}'[verbose mode]' \ '(-o --offset -a --all)'{-a,--all}'[show the status of all loop devices]' \ - '(-O --output)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd - name autoclear back-file back-ino back-maj\:min maj\:min offset partscan ro sizelimit dio log-sec' \ + '(-O --output --output-all)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd - name autoclear back-file back-ino back-maj\:min maj\:min offset partscan ro sizelimit dio log-sec' \ + '(-O --output)--output-all[output all columns]' \ '(-J --json --raw -O --output -n --noheadings)'{-J,--json}'[use JSON --list output format]' \ '(-l --list)'{-l,--list}'[list currently used loop devices]' \ '(-J --json)--raw[raw output format]' \ diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk index f37305445..1a3687c45 100644 --- a/Completion/Linux/Command/_lsblk +++ b/Completion/Linux/Command/_lsblk @@ -15,6 +15,7 @@ _arguments -C -s -S \ '(H -p --paths)'{-p,--paths}'[print complete device path]' \ '(H -s --inverse)'{-s,--inverse}'[reverse dependency order]' \ '(H -x --sort)'{-x+,--sort=}'[sort output by specified column]:column:->columns' \ + '(H)--sysroot=[use specified directory as system root]:directory:_directories' \ '*:device:_files -g "*(-%b)" -P / -W /' \ + fields \ '(H -D --discard -o --output -O --output-all)'{-D,--discard}'[output discard capabilities]' \ diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind index 4187c3cc1..21b7d88c7 100644 --- a/Completion/Linux/Command/_valgrind +++ b/Completion/Linux/Command/_valgrind @@ -1,8 +1,8 @@ #compdef valgrind -value-,VALGRIND_OPTS,-default- local curcontext="$curcontext" state line -local -a cmd common common_{mem_null,read_varinfo} -local -a args args_{addrcheck,drd,memcheck,cachegrind,helgrind,lackey,massif,none} +local -a cmd common_{own_malloc,read_varinfo,report_errors,partial} +local -a args args_{addrcheck,drd,memcheck,cachegrind,helgrind,lackey,massif,none,exp_{bbv,dhat,sgcheck}} cmd=( '1: : _command_names -e' @@ -16,31 +16,74 @@ if [[ $service = *_OPTS* ]]; then cmd=() fi -common=( - '--alignment=-[set minimum alignment of allocations]:number' +common_own_malloc=( + '--alignment=-[set minimum alignment of heap allocations]:number [16]' + '--redzone-size=-[set minimum size of redzones added before/after heap blocks]:size (bytes) [16]' + '--xtree-memory=-[profile heap memory in an xtree [none]:(none allocs full)' + '--xtree-memory-file=-[specify xtree memory report file]:file [xtmemory.kcg.%p]:_files' ) common_read_varinfo=( '--read-var-info=-[read DWARF3 debug info]:enable:(yes no)' ) -common_mem_null=( +common_report_errors=( '--xml=-[output everything in XML]:enable:(yes no)' + '--xml-fd=-[send XML output to file descriptor]:file descriptor:_file_descriptors' + '--xml-file=-[send XML output to specified file]:file:_files' + '--xml-socket=-[send XML output to specified socket]:socket:_hosts' '--xml-user-comment=-[copy specified string verbatim to XML output]:string' + '--demangle=-[automatically demangle C++ names]:enable:(yes no)' \ + '--num-callers=-[specify no of callers to show in stack traces]:number' \ + '--error-limit=-[stop showing new errors if too many]:enable:(yes no)' \ + '--exit-on-first-error=-[exit on the first error]:enable:(yes no)' \ + '--error-exitcode=-[exit code to return if errors found]:exit code' \ + '--error-markers=-[add lines with begin/end markers before/after]:markers (begin,end)' \ + '--keep-debuginfo=-[keep symbols etc for unloaded code]:enable:(yes no)' \ + '--show-below-main=-[continue stack traces below main()]:enable [no]:(yes no)' \ + '--default-suppression=-[load default suppressions]:enable [yes]:(yes no)' \ + '--suppressions=-[suppress errors described in specified file]:file:_files' \ + '--gen-suppressions=-[print suppressions for errors detected]:enable:(yes no)' \ + '--input-fd=-[specify file descriptor for input]:file descriptor:_file_descriptors' \ + '--max-stackframe=-[assume stack switch for SP changes larger than specified size]:size (bytes)' \ + "--main-stacksize=-[set size of main thread's stack]:size (bytes)" \ ) +[[ $OSTYPE = darwin* ]] && common_report_errors+=( + '--dsymutil=-[run dsymutil on Mac OS X when helpful]:enable [yes]:(yes no)' +) + +common_partial='--partial-loads-ok=-:enable:(yes no)' args_addrcheck=( - $common + $common_own_malloc $common_mem_null - '--partial-loads-ok=-:enable:(yes no)' - '--freelist-vol=-[volume of freed blocks queue]:blocks' - '--leak-check=-[search for memory leaks at exit]:enable:(yes no)' - '--leak-resolution=-[how much bt merging in leak check]:level:(low med high)' - '--show-reachable=-[show reachable blocks in leak check]:enable:(yes no)' - '--workaround-gcc296-bugs=-:enable:(yes no)' + '--leak-check=-[search for memory leaks at exit]:enable [summary]:(no summary full)' + '--leak-resolution=-[specify differentiation of leak stack traces]:level [high]:(low med high)' + '(--show-reachable --show-possibly-lost)--show-leak-kinds=-[specify leak kinds to show]:leak kind [definite,possible]:_sequence compadd - definite indirect possible reachable' + '--errors-for-leak-kinds=-[specify which leak kinds are errors]:leak kind [definite,possible]:_sequence compadd - definite indirect possible reachable all none' + '--leak-check-heuristics=-[specify heuristics to use for during leak searches]:heuristic:_sequence compadd - stdstring length64 newarray multipleinheritance all none' + '(--show-leak-kinds)--show-reachable=-[show reachable blocks in leak check]:enable:(yes no)' + '(--show-leak-kinds)--show-possibly-lost=-:enable:(yes no)' + '--xtree-leak=-[output leak result in xtree format]:enable [no]:(yes no)' + '--xtree-leak-file=-[specify xtree leak report file]:file [xtleak.kcg.%p]:_files' + '--undef-value-errors=-[check for undefined value errors]:enable [yes]:(yes no)' + '--track-origins=-[show origins of undefined values]:enable [no]:(yes no)' + $common_partial + '--expensive-definedness-checks=-[use extra-precise definedness tracking]:enable [auto]:(no auto yes)' + '--freelist-vol=-[specify volume of freed blocks queue]:blocks [20000000]' + '--freelist-big-blocks=-[release first blocks larger than specified size]:size [1000000]' + '--workaround-gcc296-bugs=-:enable [no]:(yes no)' + '--ignore-ranges=-[assume given addresses are OK]:address ranges' + "--ignore-range-below-sp=-[don't report errors for accesses at the given offsets below SP]:offsets" + "--malloc-fill=-[fill malloc'd areas with given value]:value (hex)" + "--free-fill=-[fill free'd areas with given value]:value (hex)" + "--keep-stacktraces=-[control which stack traces to keep for malloc'd/free'd areas]:stack traces [alloc-and-free]:(alloc free alloc-and-free alloc-then-free none)" + "--show-mismatched-frees=-[show frees that don't match the allocator]:enable [yes]:(yes no)" ) args_drd=( + $common_own_malloc + $common_read_varinfo '--check-stack-var=-[detect data races on stack variables]:enable [no]:(yes no)' '--exclusive-threshold=-[print an error if any mutex or writer lock is held longer than specified time]:time (ms)' '--first-race-only=-[report only the first detected data race]:enable [no]:(yes no)' @@ -73,11 +116,14 @@ args_memcheck=( args_cachegrind=( '--I1=-[set I1 cache manually]:size,assoc,line_size' '--D1=-[set D1 cache manually]:size,assoc,line_size' - '--L2=-[set L2 cache manually]:size,assoc,line_size' + '--LL=-[set LL cache manually]:size,assoc,line_size' + '--cache-sim=-[collect cache stats]:enable [yes]:(yes no)' + '--branch-sim=-[collect branch prediction stats]:enable [no]:(yes no)' + '--cachegrind-out-file=-[specify output file name]:file name [cachegrind.out.%p]:_files' ) args_helgrind=( - $common + $common_own_malloc $common_read_varinfo '--free-is-write=-[treat heap frees as writes]:enable [no]:(yes no)' '--track-lockorders=-[show lock ordering errors]:enable [yes]:(no yes)' @@ -86,31 +132,68 @@ args_helgrind=( approx\:full\ trace\ for\ one\ thread,\ approx\ for\ the\ other\ \(faster\) none\:only\ show\ trace\ for\ one\ thread\ in\ a\ race\ \(fastest\) ))' + '--delta-stacktrace=-[derive a stacktrace from the previous stacktrace]:enable:(yes no)' '--conflict-cache-size=-[specify size of full history cache]:size [2000000]' '--check-stack-refs=-[race-check reads and writes on the main stack and thread stacks]:enable [yes]:(no yes)' '--ignore-thread-creation=-[ignore activities during thread creation]:enable [no]:(yes no)' ) args_lackey=( - '--fnname=-[count calls to specified name]:name' - '--detailed-counts=-[count loads, stores and alu ops]:enable:(yes no)' + '--basic-counts=-[count instructions, jumps, etc.]:enable [yes]:(yes no)' + '--detailed-counts=-[count loads, stores and alu ops]:enable [no]:(yes no)' + '--trace-mem=-[trace all loads and stores]:enable [no]:(yes no)' + '--trace-superblocks=-[trace all superblock entries]:enable [no]:(yes no)' + '--fnname=-[count calls to specified name]:name [main]' ) args_massif=( - $common - '--heap=-[profile heap blocks]:enable:(yes no)' - '--heap-admin=-[specify average admin bytes per heap block]:bytes' - '--stacks=-[enable profile stacks]:enable:(yes no)' - '--depth=-[depth of contexts]:depth' - '--alloc-fn=-[specify alloc function]:function' - '--format=-[specify format of textual output]:format:(text html)' + $common_own_malloc + '--heap=-[profile heap blocks]:enable [yes]:(yes no)' + '--heap-admin=-[specify average admin bytes per heap block]:size (bytes) [8]' + '--stacks=-[profile stacks]:enable [no]:(yes no)' + '--pages-as-heap=-[profile memory at the page level]:enable [no]:(yes no)' + '--depth=-[depth of contexts]:depth [30]' + '*--alloc-fn=-[specify alloc function]:function' + '*--ignore-fn=-[ignore heap allocations within specified function]:function' + '--threshold=-[specify significance threshold]:threshold (percentage) [1.0]' + '--peak-inaccuracy=-[specify maximum peak inaccuracy]:inaccuracy (percentage) [1.0]' + "--time-unit=-[specify time unit]:unit [i]:(( + i\:instructions\ executed + ms\:milliseconds + b\:heap\ bytes\ alloc\'d/dealloc\'d + ))" + '--detailed-freq=-[every Nth snapshot should be detailed]:snapshot interval [10]' + '--max-snapshots=-[specofy maximum number of snapshots recorded]:maximum [100]' + '--massif-out-file=-[specify output file name]:filename [massif.out.%p]:_files' +) + +args_exp_bbv=( + '--bb-out-file=-[specify filename for BBV info]:filename:_files' + '--pc-out-file=-[specify filename for BB addresses and function names]:filename:_files' + '--interval-size=-[specify interval size]:size (instructions) [100000000]' + '--instr-count-only=-[only print total instruction count]:enable:(yes no)' +) + +args_exp_dhat=( + '--show-top-n=-[show specified number of the top alloc points]:number [10]' + '--sort-by=-[sort the allocation points by specified metric]:metric [max-bytes-live]:(( + max-bytes-live\:maximum\ live\ bytes + tot-bytes-allocd\:bytes\ allocated\ in\ total\ \(turnover\) + max-blocks-live\:maximum\ live\ blocks + tot-blocks-allocd\:blocks\ allocated\ in\ total\ \(turnover\) + ))' +) + +args_exp_sgcheck=( + $common_partial + '--enable-sg-checks=-[enable stack & global array checking]:enable [yes]:(yes no)' ) args_none=( $common_mem_null ) -args="args_${${words[(r)--tool=*]#*=}:-memcheck}" +args="args_${${${words[(r)--tool=*]#*=}/-/_}:-memcheck}" _arguments -C ${(P)args} $cmd \ '(--version)--tool=-[specify valgrind tool]:valgrind tool:->tools' \ @@ -120,27 +203,43 @@ _arguments -C ${(P)args} $cmd \ '(-q --quiet)'{-q,--quiet}'[run silently; only print error msgs]' \ '(-v --verbose)'{-v,--verbose}'[be more verbose]' \ '--trace-children=-[valgrind-ise child processes]:enable:(yes no)' \ + '--trace-children-skip=-[specify a list of executables not to trace into]:executables' \ + '--trace-children-skip-by-arg=-[specify a list of executables matched by argv not to trace into]:executables' \ + '--child-silent-after-fork=-[omit child output between fork & exec]:enable:(yes no)' \ + '--vgdb=-[activate gdbserver]:enable [yes]:(yes no full)' \ + '--vgdb-error=-[invoke gdbserver after specified number of errors]:errors [999999999]:errors' \ + '--vgdb-stop-at=-[invoke gdbserver for given events]:event:_sequence compadd - startup exit valgrindabexit all none' \ '--track-fds=-[track open file descriptors]:enable:(yes no)' \ '--time-stamp=-[add timestamps to log messages]:enable:(yes no)' \ '--log-fd=-[log messages to specified file descriptor]:file descriptor:_file_descriptors' \ '--log-file=-[log messages to specified file with pid appended]:file:_files' \ - '--log-file-exactly=-[log messages to specified file]:file:_files' \ - '--log-file-qualifier=-[log messages to filename given by specified environment variable]:variable:_parameters -g "*scalar*"' \ '--log-socket=-[log messages to socket]:ipaddr\:port' \ - '--run-libc-freeres=-[free up glibc memory at exit]:enable:(yes no)' \ - '--sim-hints=-[enable hint]:hint:(lax-ioctls enable-outer)' \ - '--show-emwarns=-[show warnings about emulation limits]:enable:(yes no)' \ - '--kernel-variant=-[handle non-standard kernel variants]:kernel variant:_values -s , kernel\ variant bproc' \ - '--demangle=-[automatically demangle C++ names]:enable:(yes no)' \ - '--num-callers=-[specify no of callers to show in stack traces]:number' \ - '--error-limit=-[stop showing new errors if too many]:enable:(yes no)' \ - '--show-below-main=-[continue stack traces below main()]:enable:(yes no)' \ - '--suppressions=-[suppress errors described in specified file]:file:_files' \ - '--gen-suppressions=-[print suppressions for errors detected]:enable:(yes no)' \ - '--db-attach=-[start debugger when errors detected]:enable:(yes no)' \ - '--db-command=-[specify command to start debugger]: : _command_names -e' \ - '--input-fd=-[specify file descriptor for input]:file descriptor:_file_descriptors' \ - '--max-stackframe=-[assume stack switch for SP changes larger than specified number of bytes]:bytes' \ + '*--fullpath-after=-[show full source paths in call stacks]::prefix to remove from paths:_directories' \ + '--extra-debuginfo-path=-[specify absolute path to search for additional debug symbols]:path:_directories' \ + '--debuginfo-server=-[specify server to query for debug symbols]:server:_hosts' \ + "--allow-mismatched-debuginfo=-[accept debuginfo objects that don't match the main object]:enable [no]:(yes no)" \ + '--smc-check=-[check for self-modifying code]:checks [all-non-file]:(none stack all all-non-file)' \ + '--read-inline-info=-[read debug info about inlined functions to improve stack traces]:enable:(yes no)' \ + '--vgdb-poll=-[specify gdbserver poll max]:basic blocks [5000]' \ + '--vgdb-shadow-registers=-[let gdb see the shadow registers]:enable [yes]:(yes no)' \ + '--vgdb-prefix=-[specify prefix for bgdb FIFOs]:prefix:_files' \ + '--run-libc-freeres=-[free up glibc memory at exit]:enable [yes]:(yes no)' \ + '--run-cxx-freeres=-[free up libstdc++ memory at exit]:enable [yes]:(yes no)' \ + '--sim-hints=-[activate unusual sim behaviours]:hint [none]:_sequence compadd - lax-ioctls lax-doors fuse-compatible enable-outer no-inner-prefix no-nptl-pthread-stackcache fallback-llsc none' \ + '--fair-sched=-[schedule threads fairly on multicore systems]:enable [no]:(yes no try)' \ + '--kernel-variant=-[handle non-standard kernel variants]:kernel variant:_sequence compadd - bproc android-no-hw-tls android-gpu-sgx5xx android-gpu-adreno3xx' \ + '--merge-recursive-frames=-[merge frames between identical program counters in specified max frames]:frames [0]' \ + '--num-transtab-sectors=-[specify size of translated code cache]:size (sectors) [32]' \ + '--avg-transtab-entry-size=-[specify average size of a translated basic block]:size (bytes)' \ + '--aspace-minaddr=-[avoid mapping memory below address]:address (0xPP) [guessed]' \ + "--valgrind-stacksize=-[specify size of valgrind (host) thread's stack]:size (bytes) [1048576]" \ + '--show-emwarns=-[show warnings about emulation limits]:enable [no]:(yes no)' \ + '*--require-text-symbol=-[abort run if the specified shared object lacks specified symbol]:\:soname pattern\:symbol pattern' \ + '*--soname-synonyms=-[specify patterns to map sonames to replacements]:soname=replacement' \ + '--sigill-diagnostics=-[warn about illegal instructions]:enable [yes]:(yes no)' \ + '--unw-stack-scan-thresh=-[enable stack-scan unwind if fewer than specified number of good frames found]:frames' \ + '--resync-filter=-[attempt to avoid expensive address-space-resync operations]:enable:(yes no verbose)' \ + '--max-threads=-[specify maximum number of threads that valgrind can handle]:threads [500]' \ && return typeset -a tools @@ -151,12 +250,10 @@ if [[ -n "$state" ]]; then # Basically uses debug output to find out the directory where the tools are # present and lists all executables in that directory. # Hope the program provides a neater interface some day! - () { - setopt localoptions histsubstpattern - tools=( ${${${(M)${(f)"$(_call_program tools valgrind --tool=something -d 2>&1)"}:#*launcher launching *something*}##*launcher launching }%%something*}*~*.*(*:t:s/-*//) ) - typeset -U tools - } - _wanted tools exl 'valgrind tool' compadd $tools && return + tools=( ${${${${(M)${(f)"$(_call_program tools $words[1] --tool=something -d 2>&1)"}:#*launcher launching *something*}##*launcher launching }%%something*}:-${commands[valgrind]:h:h}/lib/valgrind/}*~*.*(*:t) ) + tools=( ${tools%-*-*} ) + typeset -U tools + _wanted tools exl 'valgrind tool' compadd -a tools && return fi return 1 -- cgit 1.4.1