From ab7ec8d9851fea8230e1ccfba284c5bfaf457d88 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 3 May 2015 16:53:47 +0200 Subject: 35011: update completions for some common Unix commands, in particular improving FreeBSD support --- Completion/Unix/Command/_readelf | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Completion/Unix/Command/_readelf (limited to 'Completion/Unix/Command/_readelf') diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf new file mode 100644 index 000000000..9312ea864 --- /dev/null +++ b/Completion/Unix/Command/_readelf @@ -0,0 +1,62 @@ +#compdef readelf eu-readelf + +local variant args sections + +_elf_file() { + [[ -x $REPLY || $REPLY = (core*|*.([ao]|so|elf)) ]] +} + +sections=( .bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text ) +_pick_variant -r variant elftoolchain=elftoolchain elfutils=elfutils binutils --version + +args=( + '(-a --all)'{-a,--all}'[show all tables]' + '(-h --file-header)'{-h,--file-header}'[show file header]' + '(-l --program-headers --segments)'{-l,--program-headers,--segments}'[show program headers]' + '(-S --section-headers --sections)'{-S,--section-headers,--sections}'[show sections header]' + '(-s --syms --symbols)'{-s,--syms,--symbols}'[show symbol table]' + '(-n --notes)'{-n,--notes}'[show core notes (if present)]' + '(-r --relocs)'{-r,--relocs}'[show relocations (if present)]' + '(-d --dynamic)'{-d,--dynamic}'[show dynamic section (if present)]' + '(-V --version-info)'{-V,--version-info}'[show version sections (if present)]' + '(-A --arch-specific)'{-A,--arch-specific}'[show architecture specific information (if any)]' + '(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]' + \*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)" + \*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)" + '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t)' + '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges)' + '(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]' + '(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]' + '(- *)'{-H,--help}'[display help information]' + '(- *)'{-v,--version}'[display version information]' + "*:elf file:_files -g '*(-.e:_elf_file:)'" +) + +case $variant in + elftoolchain|binutils) + args+=( + '(-g --section-groups)'{-g,--section-groups}'[show section groups]' + '(-t --section-details)'{-t,--section-details}'[show section details]' + '(-e --headers)'{-e,--headers}'[show file, program and sections headers]' + '(-u --unwind)'{-u,--unwind}'[show unwind info (if present)]' + '(-D --use-dynamic)'{-D,--use-dynamic}'[use dynamic section info when showing symbols]' + ) + ;| + binutils) + args+=( + '--dyn-syms[show dynamic symbol table]' + \*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)" + "--dwarf-depth=[don't show DIEs at greater than specified depth]:depth" + '--dwarf-start=[show DIEs starting at specified depth or deeper]:depth' + ) + ;; + elfutils) + args+=( + '--elf-section[used specified section as ELF input data]::section' + '(-e --exception)'{-e,--exception}'[show sections for exception handling]' + '(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]" + ) + ;; +esac + +_arguments -s "$args[@]" -- cgit 1.4.1