fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
e0916e793
master
1# Don't go invoking valgrind unless it is installed 2 3set -l skin tool 4if valgrind --version2> /dev/null| string match -qr --'-2\.[012]\.' 5# In older versions of Valgrind, the skin selection option was 6# '--skin' 7# But someone decided that it would be fun to change this to 8# '--tool' for no good reason 9set skin skin 10end 11 12complete -xc valgrind -l$skin -d Skin -a" 13memcheck\tHeavyweight\ memory\ checker 14cachegrind\tCache-miss\ profiler 15addrcheck\tLightweight\ memory\ checker 16helgrind\tData-race\ detector 17massif\tHeap\ profiler 18" 19 20function __fish_valgrind_skin --argument-names tool -V skin 21set -l cmd( commandline -cpx) 22# Quote $cmd so the tokens are separated with a space 23if string match -qr --"-- $skin (=| ) $tool " " $cmd " 24return 0 25end 26# memcheck is the default tool/skin 27test $tool = memcheck 28and not string match --$skin $cmd 29end 30 31complete -c valgrind -l help -d"Display help and exit" 32complete -c valgrind -l help-debug -d"Display help and debug options" 33complete -c valgrind -l version -d"Display version and exit" 34complete -c valgrind -s q -l quiet -d"Quiet mode" 35complete -c valgrind -s v -l verbose -d"Verbose mode" 36complete -xc valgrind -l trace-children -d"Valgrind-ise children" -a"yes no" 37complete -xc valgrind -l track-fds -d"Track file descriptors" -a"yes no" 38complete -xc valgrind -l log-fd -d"Log to file descriptor" -a"0 1 2 3 4 5 6 7 8 9" 39complete -rc valgrind -l log-file -d"Log to file" 40complete -xc valgrind -l logsocket -d"Log to socket" 41complete -c valgrind -l demangle -xd"Demangle C++ names" -a"yes no" 42complete -xc valgrind -l num-callers -d"Callers in stack trace" 43complete -xc valgrind -l error-limit -d"Stop showing errors if too many" -a"yes no" 44complete -xc valgrind -l show-below-main -d"Continue trace below main()" -a"yes no" 45complete -rc valgrind -l suppressions -d"Suppress errors from file" 46complete -c valgrind -l gen-suppressions -d"Print suppressions for detected errors" 47complete -xc valgrind -l db-attach -d"Start debugger on error" -a"yes no" 48complete -rc valgrind -l db-command -d"Debugger command" 49complete -xc valgrind -l input-fd -d"File descriptor for input" -a"0 1 2 3 4 5 6 7 8 9" 50 51# Memcheck-specific options 52complete -n"__fish_valgrind_skin memcheck" -xc valgrind -l leak-check -d"Check for memory leaks" -a"no\tDon\'t\ check\ for\ memory\ leaks summary\t'Show a leak summary' full\t'Describe memory leaks in detail'" 53complete -n"__fish_valgrind_skin memcheck" -xc valgrind -l show-reachable -d"Show reachable leaked memory" -a"yes\t'Show reachable leaked memory' no\t'Do not show reachable leaked memory'" 54complete -n"__fish_valgrind_skin memcheck" -xc valgrind -l leak-resolution -d"Determines how willingly Memcheck considers different backtraces to be the same" -a"low\t'Two entries need to match' med\t'Four entries need to match' high\t'All entries need to match'" 55complete -n"__fish_valgrind_skin memcheck" -xc valgrind -l freelist-vol -d"Set size of freed memory pool" 56complete -n"__fish_valgrind_skin memcheck" -xc valgrind -l partial-loads-ok -d'How to handle loads of words that are partially addressable' -a'yes\t"Do not emit errors on partial loads" no\t"Emit errors on partial loads"' 57complete -n"__fish_valgrind_skin memcheck" -xc valgrind -l avoid-strlen-errors -d'Whether to skip error reporting for the strlen function' -a'yes no' 58 59# Addrcheck-specific options 60complete -n"__fish_valgrind_skin addrcheck" -xc valgrind -l leak-check -d"Check for memory leaks" -a"no\t'Do not check for memory leaks' summary\t'Show a leak summary' full\t'Describe memory leaks in detail'" 61complete -n"__fish_valgrind_skin addrcheck" -xc valgrind -l show-reachable -d"Show reachable leaked memory" -a"yes\t'Show reachable leaked memory' no\t'Do not show reachable leaked memory'" 62complete -n"__fish_valgrind_skin addrcheck" -xc valgrind -l leak-resolution -d"Determines how willingly Addrcheck considers different backtraces to be the same" -a"low\t'Two entries need to match' med\t'Four entries need to match' high\t'All entries need to match'" 63complete -n"__fish_valgrind_skin addrcheck" -xc valgrind -l freelist-vol -d"Set size of freed memory pool" 64complete -n"__fish_valgrind_skin addrcheck" -xc valgrind -l partial-loads-ok -d'How to handle loads of words that are partially addressable' -a'yes\t"Do not emit errors on partial loads" no\t"Emit errors on partial loads"' 65complete -n"__fish_valgrind_skin addrcheck" -xc valgrind -l avoid-strlen-errors -d'Whether to skip error reporting for the strlen function' -a'yes no' 66 67# Cachegrind-specific options 68complete -n"__fish_valgrind_skin cachegrind" -xc valgrind -l I1 -d"Type of L1 instruction cache" 69complete -n"__fish_valgrind_skin cachegrind" -xc valgrind -l D1 -d"Type of L1 data cache" 70complete -n"__fish_valgrind_skin cachegrind" -xc valgrind -l L2 -d"Type of L2 cache" 71 72function __fish_print_function_prototypes -d"Prints the names of all function prototypes found in the headers in the current directory" 73set -l headers *.h *.hh *.hpp *.hxx 74if set -q headers[ 1 ] 75sed -n"s/^\(.*[^[a-zA-Z_0-9]\|\)\([a-zA-Z_][a-zA-Z_0-9]*\) *(.*);.*\$/\2/p" $headers 76end 77end 78 79# Massif-specific options 80complete -c valgrind -n"__fish_valgrind_skin massif" -l alloc-fn -d"Specify a function that allocates memory" -x -a"(__fish_print_function_prototypes)" 81complete -c valgrind -n"__fish_valgrind_skin massif" -x -l heap -d'Profile heap usage' -a'yes\t"Profile heap usage" no\t"Do not profile heap usage"' 82complete -c valgrind -n"__fish_valgrind_skin massif" -x -l heap-admin -d"The number of bytes of heap overhead per allocation" 83complete -c valgrind -n"__fish_valgrind_skin massif" -x -l stacks -d"Profile stack usage" -a'yes\t"Profile stack usage" no\t"Do not profile stack usage"' 84complete -c valgrind -n"__fish_valgrind_skin massif" -x -l depth -d"Depth of call chain" 85complete -c valgrind -n"__fish_valgrind_skin massif" -x -l format -d"Profiling output format" -a"html\t'Produce html output' text\t'Produce text output'"