summary refs log tree commit diff
path: root/Completion/Unix/Command/_objdump
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2017-12-31 10:11:59 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2017-12-31 10:11:59 +0900
commit3c24adb2edcf8c7cd36e7bb90add9611f37f48d4 (patch)
tree5870d99322841ad0a9f7f2622ee46b3d0422bc4a /Completion/Unix/Command/_objdump
parentdd5ab15b5f5867ee377b116572858bfd46e82d3a (diff)
downloadzsh-3c24adb2edcf8c7cd36e7bb90add9611f37f48d4.tar.gz
zsh-3c24adb2edcf8c7cd36e7bb90add9611f37f48d4.tar.xz
zsh-3c24adb2edcf8c7cd36e7bb90add9611f37f48d4.zip
42183: _objdump: support LLVM variant
Diffstat (limited to 'Completion/Unix/Command/_objdump')
-rw-r--r--Completion/Unix/Command/_objdump78
1 files changed, 74 insertions, 4 deletions
diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump
index e012b4cbc..8b0653267 100644
--- a/Completion/Unix/Command/_objdump
+++ b/Completion/Unix/Command/_objdump
@@ -1,12 +1,13 @@
-#compdef objdump eu-objdump
+#compdef objdump eu-objdump llvm-objdump
 
-local args files variant context state state_descr line
+local opts args files variant curcontext=$context state state_descr line
 typeset -A opt_args
 
 files='*:object file:_object_files'
 
-_pick_variant -r variant binutils=GNU elfutils=elfutils unix --version
+_pick_variant -r variant binutils=GNU elfutils=elfutils llvm=LLVM unix --version
 
+opts=( -s -S )	# options for _arguments
 args=(
   "(-d --disassemble)"{-d,--disassemble}"[Display assembler code of executable sections]"
   "(-r --reloc)"{-r,--reloc}"[Display relocation information]"
@@ -80,9 +81,74 @@ case $variant in
 
     )
   ;;
+  llvm)
+    opts=( -S )	# no option stacking
+    args=(	# start over from an empty array
+      '-aarch64-neon-syntax=[chose style of NEON code (AArch64)]:style:(generic apple)'
+      '-arch=[w -macho: select arch from a fat binary]:arch:(i386 x86_64)'
+      '-arch-name=[specify target arch to disassemble for]:arch:->llvm_targets'
+      '-archive-headers[w -macho: print archive headers]'
+      '-archive-member-offsets[w -macho -archive-headers: print offset to each archive member]'
+      '-bind[display Mach-O binding info]'
+      '-color[use colored syntax highlighting]'
+      '-data-in-code[w -macho: print data in code table]'
+      "-dis-symname=[w -macho: disassemble just the specfied symbol's instructions]"
+      '(-disassemble -d)'{-disassemble,-d}'[display assembler mnemonics for machine instructions]'
+      '(-disassemble-all -D)'{-disassemble-all,-D}'[disassemble all instruction sections]'
+      '-dsym=[w -macho -g: use the specified .dSYM file for debug info]:dsym file:_files'
+      '-dwarf=[dump of dwarf debug section]:section:(frames)'
+      "-dyld-id[w -macho: print the shared library's id for dylib Mach-O file]"
+      '-dylibs-used[w -macho: print the shared libraries used for linked Mach-O files]'
+      '-exports-trie[display Mach-O exported symbols]'
+      '-fault-map-section[display contents of faultmap section]'
+      '-filter-print-funcs=[only print IR for the specified functions]:function names'
+      '-full-leading-addr[w -macho: print full leading address]'
+      '-g[w -macho: print line information from debug info if available]'
+      '-indirect-symbols[w -macho: print indirect symbol table]'
+      '-info-plist[w -macho: print the info plist section]'
+      '-lazy-bind[display Mach-O lazy binding info]'
+      '(-line-numbers -l)'{-line-numbers,-l}'[display source line numbers with disassembly]'
+      '-link-opt-hints[w -macho: print the linker optimization hints]'
+      '(-macho -m)'{-macho,-m}'[use Mach-O specific object file parser]'
+      '*-mattr=[target specific attributes]:attributes'
+      '-mcpu=[specify target cpu type]:cpu type'
+      '-no-leading-addr[w -macho: print no leading address]'
+      '-no-leading-headers[print no leading headers]'
+      '-no-show-raw-insn[do not print instruction bytes when disassembling]'
+      '-no-symbolic-operands[w -macho: do not print operands symbolically when disassembling]'
+      '-non-verbose[w -macho: print info in non-verbose form]'
+      '-objc-meta-data[w -macho: print Objective-C runtime meta data]'
+      '-print-after-all[print IR after each pass]'
+      '-print-before-all[print IR before each pass]'
+      '-print-imm-hex[use hex format for immediate values]'
+      '-private-header[display only the first format specific file header]'
+      '(-private-headers -p)'{-private-headers,-p}'[display format specific file headers]'
+      '-r[display the relocation entries in the file]'
+      '-raw-clang-ast[dump raw binary contents of clang AST section]'
+      '-rebase[display Mach-O rebasing info]'
+      '-rng-seed=[seed for the random number generator]:seed'
+      '-s[display contents of each section]'
+      '*'{-section=,-j}'[operate on the specified section only]:section'
+      '(-section-headers -h)'{-section-headers,-h}'[display summaries of the headers for each section]'
+      '(-source -S)'{-source,-S}'[display source inlined with disassembly]'
+      '-start-address=[start disassembly at the specified address]:address'
+      '-stop-address=[stop disassembly at the specified address]:address'
+      '-t[display the symbol talbe]'
+      '-time-passes[time each pass, print elapsed time on exit]'
+      '-triple=[target triple to disassemble for]:triple'
+      '-universal-headers[w -macho: print Mach-O universal headers]'
+      '-verify-dom-info[verify dominator info (time consuming)]'
+      '-unwind-info[display unwind information]'
+      '-weak-bind[display Mach-O weak binding info]'
+      '-x86-asm-syntax=[chose style of assembler code (x86)]:style:(att intel)'
+      '(- *)-help[display available options]'
+      '(- *)-help-list[display list of available options]'
+      '(- *)-version[display version of objdump]'
+    )
+  ;;
 esac
 
-_arguments -s -S : "$args[@]" $files
+_arguments $opts -C : "$args[@]" $files && return 0
 
 case "$state" in
   short_dwarf_names)
@@ -100,6 +166,10 @@ case "$state" in
   disassembler_options)
     _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:#  [^ ]*}#  }%% *}"
   ;;
+  llvm_targets)
+    _values "target architecture" "${(z)${(@)${(f)$(_call_program targets
+	    ${~words[1]} -version)##*Registered Targets:}/ -*}}"
+  ;;
 esac