about summary refs log tree commit diff
path: root/Completion/Linux/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Linux/Command')
-rw-r--r--Completion/Linux/Command/_valgrind153
1 files changed, 96 insertions, 57 deletions
diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind
index 3d015b217..18778c5a4 100644
--- a/Completion/Linux/Command/_valgrind
+++ b/Completion/Linux/Command/_valgrind
@@ -1,57 +1,96 @@
-#compdef valgrind 
-#Generated by
-#   simple2long.xsl
-#   args.xsl
-#   Post-handedits
-#   For details see:
-#       http://www.geocities.com/f_rosencrantz/xml_completion.htm
-#
-#   This is for valgrind version: 1.0.0
-#   Valgrind URL: http://developer.kde.org/~sewardj/
-
-local context state line
-typeset -A opt_args
-  _arguments   \
-    '--help[show this message]' \
-    '--version[show version]' \
-    '(--quiet)-q[run silently; only print error msgs]' \
-    '(-q)--quiet[run silently; only print error msgs]' \
-    '(--verbose)-v[be more verbose, incl counts of errors]' \
-    '(-v)--verbose[be more verbose, incl counts of errors]' \
-    '--gdb-attach=-:start GDB when errors detected? [no]:(no yes)' \
-    '--demangle=-:automatically demangle C++ names? [yes]:(no yes)' \
-    '--num-callers=-:show <num> callers in stack traces [4]:' \
-    '--error-limit=-:stop showing new errors if too many? [yes]:(no yes)' \
-    '--partial-loads-ok=-:too hard to explain here; see manual [yes]:(no yes)' \
-    '--leak-check=-:search for memory leaks at exit? [no]:(no yes)' \
-    '--leak-resolution=-:amount of bt merging in leak check [low]:(low med high)' \
-    '--show-reachable=-:show reachable blocks in leak check? [no]:(no yes)' \
-    '--sloppy-malloc=-:round malloc sizes to next word? [no]:(no yes)' \
-    '--alignment=-:set minimum alignment of allocations [4]:' \
-    '--trace-children=-:Valgrind-ise child processes? [no]:(no yes)' \
-    '--logfile-fd=-:file descriptor for messages [2=stderr]:_file_descriptors' \
-    '--freelist-vol=-:volume of freed blocks queue [1000000]:' \
-    '--workaround-gcc296-bugs=-:self explanatory [no]:(no yes)' \
-    '--suppressions=-:suppress errors described in suppressions file <filename>:_files' \
-    '--check-addrVs=-:experimental lighterweight checking? [yes]:(no yes)' \
-    '--cachesim=-:do cache profiling? [no]:(no yes)' \
-    '--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):' \
-    '--weird-hacks=-:weird hacks (comma separated)[no hacks selected]:(ioctl-VTIME truncate-writes)' \
-    '--sanity-level=-:level of sanity checking to do [1]:' \
-    '--single-step=-:translate each instr separately? [no]:(no yes)' \
-    '--optimise=-:improve intermediate code? [yes]:(no yes)' \
-    '--instrument=-:actually do memory checks? [yes]:(no yes)' \
-    '--cleanup=-:improve after instrumentation? [yes]:(no yes)' \
-    '--smc-check=-:check writes for s-m-c? [some]:(none some all)' \
-    '--trace-syscalls=-:show all system calls? [no]:(no yes)' \
-    '--trace-signals=-:show signal handling details? [no]:(no yes)' \
-    '--trace-symtab=-:show symbol table details? [no]:(no yes)' \
-    '--trace-malloc=-:show client malloc details? [no]:(no yes)' \
-    '--trace-sched=-:show thread scheduler details? [no]:(no yes)' \
-    '--trace-pthread=-:show pthread event details? [none]:(none some all)' \
-    '--stop-after=-:switch to real CPU after executing <number> basic blocks [infinity]:' \
-    "--dump-error=-:show translation for basic block associated with <number>'th error context [0=don't show any]:" \
-    '1:command name:_command_names -e' \
-    '*::args :_normal'  && return 0
+#compdef valgrind -value-,VALGRIND_OPTS,-default-
+
+local curcontext="$curcontext" state line common cmd
+local -a args args_{memcheck,addrcheck,cachegrind,helgrind,massif}
+
+cmd=(
+  '1:command name:_command_names -e'
+  '*::args :_normal'
+)
+
+if [[ $service = *_OPTS* ]]; then
+  compset -q
+  words=( fake "$words[@]" )
+  (( CURRENT++ ))
+  cmd=()
+fi
+
+common=(
+  '--sloppy-malloc=-[round malloc sizes to multiple of 4]:enable:(yes no)'
+  '--alignment=-[set minimum alignment of allocations]:number'
+)
+
+args_addrcheck=(
+  $common
+  '--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]:(low med high)'
+  '--show-reachable=-[show reachable blocks in leak check]:enable:(yes no)'
+  '--workaround-gcc296-bugs=-:enable:(yes no)'
+)
+
+args_memcheck=(
+  $args_addrcheck
+  '--avoid-strlen-errors=-[suppress errs from inlined strlen]:enable:(yes no)'
+)
+
+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'
+)
+
+args_helgrind=(
+  $common
+  '--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)'
+)
+
+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)'
+)
+
+args="args_${${words[(r)--(skin|tool)=*]#*=}:-memcheck}"
+
+_arguments -C ${(P)args} $cmd \
+  '(--tool --skin)'{--tool,--skin}'=-[specify valgrind tool]:valgrind tool:->tools' \
+  '(-h --help)'{-h,--help}'[show help information]' \
+  '--help-debug[show help info including debugging options]' \
+  '--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)' \
+  '--track-fds=-[track open file descriptors]:enable:(yes no)' \
+  '--time-stamp=-[add timestamps to log messages]:enable:(yes no)' \
+  '--run-libc-freeres=-[free up glibc memory at exit]:enable:(yes no)' \
+  '--weird-hacks=-[enable hack]:hack:(lax-ioctls)' \
+  '--signal-polltime=-[signal poll period (ms)]:period' \
+  '--lowlat-signals=-[improve thread signal wake-up latency]:enable:(yes no)' \
+  '--lowlat-syscalls=-[improve thread syscall wake-up latency]:enable:(yes no)' \
+  '--pointercheck=-[enforce client address space limits]:enable:(yes no)' \
+  '--log-fd=-[log messages to specified file descriptor]:file descriptor:_file_descriptors' \
+  '--log-file=-[log messages to specified file]:file:_files' \
+  '--log-socket=-[log messages to socket]:ipaddr\:port' \
+  '--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' && return
+
+if [[ -n "$state" ]]; then
+  _wanted tools exl 'valgrind tool' compadd ${=${${(f)"$(_call_program \
+      tools valgrind --tool= 2>&1)"}[(r)Available*,-1]}[2,-1]} && return
+fi
+
+return 1