diff options
Diffstat (limited to 'Completion/Linux')
-rw-r--r-- | Completion/Linux/Command/_btrfs | 248 | ||||
-rw-r--r-- | Completion/Linux/Command/_ethtool | 12 | ||||
-rw-r--r-- | Completion/Linux/Command/_iptables | 6 | ||||
-rw-r--r-- | Completion/Linux/Command/_losetup | 3 | ||||
-rw-r--r-- | Completion/Linux/Command/_lsblk | 1 | ||||
-rw-r--r-- | Completion/Linux/Command/_valgrind | 232 |
6 files changed, 376 insertions, 126 deletions
diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs index 33b5c76f9..3ecebe62a 100644 --- a/Completion/Linux/Command/_btrfs +++ b/Completion/Linux/Command/_btrfs @@ -1,27 +1,25 @@ #compdef btrfs -# based on Btrfs v3.12+20131125 local curcontext="$curcontext" curstate state line expl grp cmd cont shift ret=1 local -a cmds_1 cmds_2 cmds_3 cmds_4 cmds_5 cmds_6 cmds_7 cmds_8 cmds_9 cmds_10 local -a groups args -groups=( subvolume filesystem device scrub balance inspect-internal +groups=( subvolume filesystem device scrub balance inspect-internal property quota qgroup replace rescue check restore send receive help version ) -cmds_1=( create delete list snapshot get-default set-default find-new show help ) -cmds_2=( df show sync defragment resize label balance help ) -cmds_3=( add delete ready scan stats help ) +cmds_1=( create delete list snapshot get-default set-default find-new show sync help ) +cmds_2=( df du show sync defragment resize label usage help ) +cmds_3=( add delete remove ready scan stats usage help ) cmds_4=( start cancel resume status help ) cmds_5=( start pause cancel resume status ) -cmds_6=( inode-resolve logical-resolve subvolid-resolve rootid help ) -cmds_7=( enable disable rescan help ) -cmds_8=( assign remove create destroy show limit help ) -cmds_9=( start status cancel help ) -cmds_10=( chunk-recover super-recover ) +cmds_6=( dump-{super,tree} {inode,logical,subvolid}-resolve min-dev-size rootid tree-stats help ) +cmds_7=( get set list ) +cmds_8=( enable disable rescan help ) +cmds_9=( assign remove create destroy show limit help ) +cmds_10=( start status cancel help ) +cmds_11=( chunk-recover fix-device-size super-recover zero-log ) -[[ $words[2] = h(|e(|l(|p))) ]] && args=( '--full[display detailed help]' ) - -_arguments -C "$args[@]" \ +_arguments -C -A "-*" "$args[@]" \ '(- *)--help[print help information]' \ '(- *)--version[print version information]' \ '(--version)1: :->groups' \ @@ -37,10 +35,10 @@ while (( $#state )); do ;; cmds) grp=${groups[(i)$words[2]*]} - (( grp && grp <= 14 )) || return 1 + (( grp && grp <= 16 )) || return 1 cont=${groups[grp]} curcontext="${curcontext%:*:*}:$service-${cont}:" - if (( grp <= 10 )); then + if (( grp <= 11 )); then _wanted commands expl command compadd -a cmds_$grp && ret=0 continue fi @@ -48,9 +46,9 @@ while (( $#state )); do args) if [[ $curstate != cmds ]]; then grp=${groups[(i)$words[1]*]} - (( grp && grp <= 15 )) || return 1 + (( grp && grp <= 16 )) || return 1 cont=${groups[grp]} - if (( grp <= 10 )); then + if (( grp <= 11 )); then local group=cmds_$grp local cmd=${${(P)group}[(i)$words[2]*]} (( cmd )) || return 1 @@ -62,18 +60,20 @@ while (( $#state )); do fi args=( '(-)--help[print help information]' ) case ${cont} in - filesystem:balance) - if (( CURRENT == 3 )); then - state+=cmds - else - shift words - (( CURRENT-- )) - state+=args - fi - continue + subvolume:create) + args+=( + '*-i[add the newly created subvolume to a qgroup]:qgroup' + '1:destination:->mounts' + ) + ;; + subvolume:delete) + args+=( + '(-c --commit-after -C --commit-each)'{-c,--commit-after}'[wait for transaction commit at the end of the operation]' + '(-c --commit-after -C --commit-each)'{-C,--commit-each}'[wait for transaction commit after deleting each subvolume]' + '(-v --verbose)'{-v,--verbose}'[verbose output of operations]' + '1:subvolume:_files -/' + ) ;; - subvolume:create) args+=( '1:destination:->mounts' );; - subvolume:delete) args+=( '1:subvolume:_files -/' );; subvolume:snapshot) args+=( '-r[readonly snapshot]' @@ -91,53 +91,100 @@ while (( $#state )); do '-o[include only subvolumes below the path]' '-u[include UUID of subvolume]' '-q[include parent UUID of subvolume]' + '-R[include the uuid of the received snapshots]' '-t[print results as a table]' '-s[list only snapshot subvolumes]' '-r[list only readonly subvolumes]' + '-d[list deleted subvolumes that are not yet cleaned]' '-G[subvolume generation is more or less than]:gen: _guard "(|+|-)[0-9]#"' '-C[subvolume ogeneration is more or less than]:ogen: _guard "(|+|-)[0-9]#"' - '--sort=-[list in order]:sort:_values -s "," sort rootid gen ogen path' + '--sort=-[list in order]:order:_sequence compadd - rootid gen ogen path' '1:path:->mounts' ) ;; subvolume:set-default) args+=( '1:id:_guard "[0-9]#" id' '2:path:->mounts' );; - subvolume:get-default) args+=( '1:path:_files -/' );; + subvolume:show) + args+=( + '(-r --rootid)'{-r,--rootid}'[rootid of the subvolume]' + '(-u --uuid)'{-u,--uuid}'[uuid of the subvolume]' + '1:subvolume path:_directories' + ) + ;; + subvolume:sync) args+=( '-s[sleep between checks]:delay (seconds) [1]' );; subvolume:find-new) args+=( '1:subvol:_files -/' '2:lastgen: _message "last gen"' );; + (device|filesystem|qgroup):(df|du|show|usage)) + args+=( + '--iec[use 1024 as a base]' + '--si[use 1000 as a base]' + ) + ;| + (device|filesystem):(df|usage)) + args+=( + '(-b --raw)'{-b,--raw}'[output raw numbers in bytes]' + '(-h --human-readable -H)'{-h,--human-readable}'[output human friendly numbers, base 1024]' + '(-h --human-readable -H)-H[output human friendly numbers, base 1000]' + '(-k --kbytes)'{-k,--kbytes}'[show sizes in KiB, or kB with --si]' + '(-m --mbytes)'{-m,--mbytes}'[show sizes in MiB, or MB with --si]' + '(-g --gbytes)'{-g,--gbytes}'[show sizes in GiB, or GB with --si]' + '(-t --tbytes)'{-t,--tbytes}'[show sizes in TiB, or TB with --si]' + ) + ;| + (filesystem|qgroup):(du|show)) + args+=( + '--raw[output raw numbers in bytes]' + '--human-readable[output human friendly numbers, base 1024]' + '--kbytes[show sizes in KiB, or kB with --si]' + '--mbytes[show sizes in MiB, or MB with --si]' + '--gbytes[show sizes in GiB, or GB with --si]' + '--tbytes[show sizes in TiB, or TB with --si]' + ) + ;| filesystem:resize) args+=( '1:size:_guard "(|+|-)[0-9]#[GKM]"' '2:path:->mounts' );; filesystem:defragment) args+=( '-v[verbose]' - '-c[compress files while defragmenting]' + '-r[defragment files recursively]' + '-c+[compress files while defragmenting]::compression algorithm:(zlib lzo zstd)' '-r[defragment files recursively]' '-f[flush after defragmenting]' '-s[start position]:byte position' '-l[defragment limited number of bytes]:length (bytes)' - '-t[defragment only files over a certain size]:minimum size (bytes)' + '-t[defragment only files over a certain size]:minimum size (bytes) [32M]' '*:file:_files' ) ;; - filesystem:label) args+=( '1:device:_files -g "*(d)"' '2:label' );; + filesystem:du) args+=( '(-s --summarize)'{-s,--summarize}'[display only a total for each argument]' );; + filesystem:label) args+=( '1:device:_files -g "*(-%)"' '2:new label' );; filesystem:show) args+=( '(1 -)'{-d,--all-devices}'[scan all devices in /dev]' '(1 -)'{-m,--mounted}'[show only mounted filesystems]' + '--raw[output raw numbers in bytes]' + '--human-readable[output human friendly numbers, base 1024]' '1: :_guard "^-*" uuid or label' ) ;; - device:(add|delete)) + filesystem:usage) args+=( '-T[show data in tabular format]' );; + device:(add|delete|ready|remove)) args+=( - '1:device:_files -g "*(d)"' + '1:device:_files -g "*(-%)"' '2:path:->mounts' ) [[ ${${(P)group}[cmd]} == add ]] && args+=( - {-K,--nodiscard}'[do not perform discard]' + {-K,--nodiscard}"[don't perform discard]" {-f,--force}'[force overwrite of existing filesystem]' ) ;; - device:scan) args+=( '(1 -)--all-devices[scan all devices in /dev]' '1:device:_files -g "*(d)"' );; - device:stats) args+=( "1:device or mountpoint:_files -g '*(d,/)'" '-z[reset stats when done]' );; - device:ready) args+=( '1:device: _files -g "*(d)"' );; + device:scan) args+=( '(1 -)'{-d,--all-devices}'[scan all devices in /dev]' '1:device:_files -g "*(-%)"' );; + device:stats) + args+=( + '(-c --check)'{-c,--check}'[return non-zero if any stat counter is not zero]' + '(-z --reset)'{-z,--reset}'[reset stats when done]' + "1:device or mountpoint:_files -g '*(-%,/)'" + ) + ;; + device:ready) args+=( '1:device: _files -g "*(-%)"' );; scrub:(start|resume)) args+=( "-B[don't background and print statistics at end]" @@ -149,10 +196,18 @@ while (( $#state )); do '-n[set ioprio classdata]:classdata:(0 1 2 3 4 5 6 7)' '1:path or device:_files' ) - [[ ${${(P)group}[cmd]} == start ]] && args+=( '-R[raw print mode]' ) + [[ ${${(P)group}[cmd]} == start ]] && args+=( + '-f[force starting new scrub even if a scrub is already running]' + ) + ;; + scrub:cancel) args+=( '1: : _guard "^-*" "path or device"' );; + scrub:status) + args+=( + '-d[separate statistics for each device]' + '-R[print raw stats]' + '1:path or device:_files' + ) ;; - scrub:cancel) args+=( '1:path or device' );; - scrub:status) args+=( '-d[separate statistics for each device]' '1:path or device:_files' );; balance:start) args+=( '(-m -s)-d+[act on data chunks]:filter:->filters' @@ -160,11 +215,21 @@ while (( $#state )); do '(-d -m)-s+[act on system chunks (only under -f)]:filters:->filters' '-v[verbose mode]' '-f[force reducing of metadata integrity]' + "--full-balance[don't print warning and don't delay start]" + '(--background --bg)'{--background,--bg}'[run balance operation asynchronously in the background]' '1:path:_files -/' ) ;; balance:status) args+=( '-v[verbose mode]' '1:path:_files -/' );; balance:(pause|cancel|resume)) args+=( '1:path:_files -/' );; + property:set) args+=( '3:value' );& + property:get) args+=( '2:property:(ro label compression)' );& + property:list) + args+=( + '-t[specify object type]:object type:(subvol filesystem inode device)' + '1:object' + ) + ;; quota:(enable|disable)) args+=( '1:path:_files -/' );; quota:rescan) args+=( @@ -174,7 +239,10 @@ while (( $#state )); do ) ;; qgroup:(assign|remove)) args+=( '1:source path:_files -/' - '2:destination path:_files -/' '3:path:_files -/' );; + '2:destination path:_files -/' '3:path:_files -/' );| + qgroup:assign) args+=( \!--rescan + "--no-rescan[don't do a rescan, even if the assignment will make the quotas inconsitent]" ) + ;; qgroup:(create|destroy)) args+=( '1:qgroupid:' '2:path:_files -/' );; qgroup:show) args+=( @@ -182,10 +250,11 @@ while (( $#state )); do '-c[print child qgroup id]' '-r[print max referenced size of qgroup]' '-e[print max exclusive size of qgroup]' - '-F[list impacted qgroups\(include ancestral qgroups\)]' - '-f[list impacted qgroups\(exclude ancestral qgroups\)]' + '-F[list impacted qgroups \(include ancestral qgroups\)]' + '-f[list impacted qgroups \(exclude ancestral qgroups\)]' '--sort=-[sort qgroups]:sort:_values -s , sort \ qgroupid rfer excl max_rfer max_excl' + '--sync[do filesystem sync before getting information]' '1:path:_files -/' ) ;; @@ -193,68 +262,106 @@ while (( $#state )); do args+=( '-c[limit amount of data after compression]' '-e[limit space exclusively to qgroup]' - ':size or none: _message "size or none"' + ': :_guard "^-*" "size or none"' ':qgroup id or path:_files -/' ':path:_files -/' ) ;; replace:start) args+=( - '-r[read from <srcdev> only]:srcdev:_files' + '-r[read from specified source device only]:srcdev:_files' '-f[force overwriting of target]' - '-B[do not background]' + "-B[don't background]" ':srcdev or devid:_files' ':target:_files' ':path:->mounts' ) ;; - replace:status) args+=( '-1[print once]' ':path:->mounts' );; + replace:status) args+=( '-1[print once rather than continuously]' ':path:->mounts' );; replace:cancel) args+=( ':path:->mounts' );; + inspect*:dump-tree) + args+=( + '(-e --extents)'{-e,--extents}'[print only extent info: extent and device trees]' + '(-d --device)'{-d,--device}'[print only device info: tree root, chunk and device trees]' + '(-r --roots)'{-r,--roots}'[print only short root node info]' + '(-R --backups)'{-R,--backups}'[same as --roots plus print backup root info]' + '(-u --uuid)'{-u,--uuid}'[print only the uuid tree]' + '(-b --block)'{-b,--block}'[print info from the specified block only]:block' + '(-t --tree)'{-t,--tree}'[print only tree with the given id (string or number)]:tree id' + '--follow[use with -b, to show all children tree blocks of the block]' + ) + ;; + inspect*:dump-super) + args+=( \!-s:byte\ number '!-i:super:(0 1 2)' + '(-f --full)'{-f,--full}'[print full superblock information, backup roots etc.]' + '(-a --all)'{-a,--all}'[print information about all superblocks]' + '(-s --super)'{-s,--super}'[specify which copy to print out]:super:(0 1 2)' + '(-F --force)'{-F,--force}'[attempt to dump superblocks with bad magic]' + '--bytenr[specify alternate superblock offset]:offset' + ) + ;; inspect*:inode*) args+=( '-v[verbose mode]' '1:inode:_files' '2:path:_files -/' );; inspect*:subvol*) args+=( '-v[verbose mode]' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );; inspect*:logical*) args+=( '-v[verbose mode]' '-P[skip the path resolving and print the inodes instead]' - '-s[buffer size]:buffer size:' + '-s[specify buffer size]:buffer size [4096]' '1:logical address:_files' '2:filesystem path:_files -/' ) ;; + inspect*:min*) args+=( '--id[specify the device id to query]:device id [1]' );; inspect*:rootid) args+=( '1:path:_files -/' );; + inspect*:tree*) args+=( '-b[print raw numbers in bytes]' );; rescue:(chunk|super)-recover) args+=( '-y[assume yes to every question]' '-v[verbose mode]' + '1:device:_files' ) - [[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('-h[display help]') + [[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('(-)-h[display help]') ;; subvolume:get-default) ;& *:sync) ;& *:df) args+=( '1:path:->mounts' );; check) - args+=( - {-s,--support}'[specify superblock]:superblock' + args+=( \!--readonly + '(-s --super)'{-s,--super}'[specify superblock]:superblock' + '(-b --backup)'{-b,--backup}'[use the backup root copy]' + '(-r --tree-root)'{-r,--tree-root}'[use specified byte number for the tree root]:byte number' + '--chunk-root[ use the given offset for the chunk tree root]:byte offset' '--repair[try to repair the filesystem]' + '--force[skip mount checks, repair is not possible]' + '--mode[select memory/IO trade-off]:mode:(original lowmem)' '--init-csum-tree[create a new CRC tree]' '--init-extent-tree[create a new extent tree]' + '--clear-space-cache[clear space cache for v1 or v2]:version:(v1 v2)' + '--check-data-csum[verify checkums of data blocks]' + '(-Q --qgroup-report)'{-Q,--qgroup-report}'[verify qgroup accounting and compare against filesystem accounting]' + '(-E --subvol-extents)'{-E,--subvol-extents}'[show extent state for the given subvolume]:subvolume id' + '(-p --progress)'{-p,--progress}'[indicate progress at various checking phases]' '1:path:_files -/' ) ;; restore) args+=( - '-s[get snapshots]' - '-x[get extended attributes]' - '-v[verbose]' - '-i[ignore errors]' - '-o[overwrite]' - '-t[tree location]:tree' - '-f[filesystem location]:filesystem' - '-u[super mirror]:mirror' - '-r[root objectid]:objectid' - '-d[find dir]' - '-l[list tree roots]' - '--path-regex[restore matching filenames]:regex' + '(-s --snapshots)'{-s,--snapshots}'[get snapshots]' + '(-x --xattr)'{-x,--xattr}'[restore extended attributes]' + '(-m --metadata)'{-m,--metadata}'[restore owner, mode and times]' + '(-S --symlink)'{-S,--symlink}'[restore symbolic links]' + '(-v --verbose)'{-v,--verbose}'[be verbose and output what is restored]' + '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors]' + '(-o --overwrite)'{-o,--overwrite}'[overwrite directories and files]' + '-t[specify tree location]:tree root' + '-f[specify filesystem location]:byte offset' + '(-u --super)'{-u,--super}'[use specified superblock mirror]:mirror:(0 1 2)' + '(-r --root)'{-r,--root}'[specify root objectid]:root id' + '-d[find directory]' + '(-l --list-roots)'{-l,--list-roots}'[list tree roots]' + '(-D --dry-run)'{-D,--dry-run}'[dry run (only list files that would be recovered)]' + '--path-regex[restore only filenames matching regex]:regex' + '-c[ignore case (--path-regex only)]' '1:device:_files -/' '2:path:_files -/' ) @@ -262,9 +369,13 @@ while (( $#state )); do send) args+=( '*-v[verbose mode]' + '-e[if sending multiple subvolumes at once, use the new format]' '-p[send incremental stream]:parent:_files -/' '*-c[use snapshot as clone source]:clone:_files -/' - '-f[output file]:file:_files' + '-f[specify output file]:file:_files' + '--no-data[send in NO_FILE_DATA mode]' + '(-v --verbose)'{-v,--verbose}'[enable verbose output]' + '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]' '1:subvolume:_files -/' ) ;; @@ -273,9 +384,14 @@ while (( $#state )); do '*-v[verbose mode]' '-f[input file]:file: _files' '-e[terminate after <end cmd>]' + '(-C --chroot)'{-C,--chroot}'[confine the process to destination path using chroot(1)]' + '(-E --max-errors)'{-E,--max-errors}'[terminate as soon as specified number of errors occur]:errors [1]' + '(--dump)-m[specify root mount point of the destination filesystem]:mount point:_directories' + '(-m)--dump[dump stream metadata, one line per operation]' '1:mount:->mounts' ) ;; + h(|e(|l(|p)))) args+=( '--full[display detailed help]' );; *) args+=( '*: :_default' );; # fallback for unknown subcommands esac if ! (( shift )); then 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/_iptables b/Completion/Linux/Command/_iptables index 447d7c932..ae8d66ea4 100644 --- a/Completion/Linux/Command/_iptables +++ b/Completion/Linux/Command/_iptables @@ -7,7 +7,7 @@ case $service in iptables-save | ip6tables-save) _arguments -s \ {-c,--counters}'[include values of packet and byte counters in output]' \ - {-t,--table}'[specify table]:table:(filter nat mangle)' + {-t,--table}'[specify table]:table:(filter nat mangle raw security)' return ;; iptables-restore | ip6tables-restore) @@ -89,7 +89,7 @@ esac local i=1 typeset -U args while - (( i=words[(ib.i.)-m|--match]+1 )) + (( i=words[(ib.i.)-m|--match]+1 )) (( i<CURRENT )); do case ${words[i]}; in ah) args+=( '--ahspi[match SPIs in AH header]:*^!:spi' ) ;; @@ -158,7 +158,7 @@ done _arguments -C -s \ '(-)'{-h,--help}'[print program information]' \ '(-)'{-V,--version}'[print version information]' \ - '(-h --help -V --version)'{-t,--table}'[specify table]:table:(filter nat mangle)' \ + '(-h --help -V --version)'{-t,--table}'[specify table]:table:(filter nat mangle raw security)' \ "($rcmds $cmds)"{-A,--append}'[append rules to end of specified chain]:chain:->chains' \ "($rcmds $cmds -c --set-counters)"{-D,--delete}'[delete rules from specified chain]:chain:->chains::rule number:->rulenums' \ "($rcmds $cmds)"{-I,--insert}'[insert rules before specified rule number]:chain:->chains::rule number:->rulenums' \ 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 1ae228c94..21b7d88c7 100644 --- a/Completion/Linux/Command/_valgrind +++ b/Completion/Linux/Command/_valgrind @@ -1,11 +1,11 @@ #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,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 name:_command_names -e' + '1: : _command_names -e' '*::args :_normal' ) @@ -16,28 +16,96 @@ 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)' + '--free-is-write=-[report races between accessing memory and freeing memory]:enable [no]:(yes no)' + '--join-list-vol=-[specify how many joined threads to retain memory access information for]:number of threads [10]' + '--report-signal-unlocked=-[report calls to pthread_cond_signal etc where the mutex is not locked]:enable [yes]:(yes no)' + '--segment-merging=-[control segment merging]:enable [yes]:(yes no)' + '--segment-merging-interval=-[perform segment merging only after the specified number of new segments have been created]:number of segments [10]' + '--shared-threshold=-[print an error if a reader lock is held longer than the specified time]:time (ms)' + '--show-confl-seg=-[show conflicting segments in race reports]:enable [yes]:(yes no)' + '--show-stack-usage=-[print stack usage at thread exit time]:enable [no]:(yes no)' + '--ignore-thread-creation=-[control whether all activities during thread creation should be ignored]:enable [no]:(yes no)' + '*--ptrace-addr=-[trace all load and store activity for specified address even after free]:address' + '*--trace-addr=-[trace all load and store activity for specified address]:address' + '--trace-alloc=-[trace all memory allocations and deallocations]:enable [no]:(yes no)' + '--trace-barrier=-[trace all barrier activity]:enable [no]:(yes no)' + '--trace-cond=-[trace all condition variable activity]:enable [no]:(yes no)' + '--trace-fork-join=-[trace all thread creation and all thread termination events]:enable [no]:(yes no)' + '--trace-hb=-[trace execution of the ANNOTATE_HAPPENS_BEFORE(), ANNOTATE_HAPPENS_AFTER() and ANNOTATE_HAPPENS_DONE() client requests]:enable [no]:(yes no)' + '--trace-mutex=-[trace all mutex activity]:enable [no]:(yes no)' + '--trace-rwlock=-[trace all reader-writer lock activity]:enable [no]:(yes no)' + '--trace-semaphore=-[trace all semaphore activity]:enable [no]:(yes no)' ) args_memcheck=( @@ -48,66 +116,130 @@ 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 - '--private-stacks=-[assume thread stacks are used privately]:enable:(yes no)' - '--show-last-access=-[show location of last word access on error]:locations:(no some all)' + '--free-is-write=-[treat heap frees as writes]:enable [no]:(yes no)' + '--track-lockorders=-[show lock ordering errors]:enable [yes]:(no yes)' + '--history-level=-[specify amount of history to show for data races]:level [full]:(( + full\:show\ both\ stack\ traces\ for\ a\ data\ race\ \(slow\) + 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 \ - '--tool=-[specify valgrind tool]:valgrind tool:->tools' \ + '(--version)--tool=-[specify valgrind tool]:valgrind tool:->tools' \ '(-h --help)'{-h,--help}'[show help information]' \ '--help-debug[show help info including debugging options]' \ - '--version[show version]' \ + '(-)--version[show version]' \ '(-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:_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 @@ -118,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 |