From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7725 invoked by alias); 29 Dec 2017 09:02:13 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42183 Received: (qmail 25332 invoked by uid 1010); 29 Dec 2017 09:02:13 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-expgw.biglobe.ne.jp by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(133.208.98.3):SA:0(-2.6/5.0):. Processed in 4.617586 secs); 29 Dec 2017 09:02:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Biglobe-Sender: From: "Jun T." Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [PATCH] _objdump: support LLVM variant Message-Id: <1769B1A8-5231-4E5A-8371-78C0526F8B73@kba.biglobe.ne.jp> Date: Fri, 29 Dec 2017 18:02:04 +0900 To: "zsh-workers@zsh.org" Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-Mailer: Apple Mail (2.1510) X-Biglobe-Spnum: 51716 Add support for LLVM variant of objdump (which is used in recent versions of macOS). I added all the options listed by 'objdump -help', although several of them seem to have no effect (simply ignored). 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 =20 -local args files variant context state state_descr line +local opts args files variant curcontext=3D$context state state_descr = line typeset -A opt_args =20 files=3D'*:object file:_object_files' =20 -_pick_variant -r variant binutils=3DGNU elfutils=3Delfutils unix = --version +_pick_variant -r variant binutils=3DGNU elfutils=3Delfutils llvm=3DLLVM = unix --version =20 +opts=3D( -s -S ) # options for _arguments args=3D( "(-d --disassemble)"{-d,--disassemble}"[Display assembler code of = executable sections]" "(-r --reloc)"{-r,--reloc}"[Display relocation information]" @@ -80,9 +81,74 @@ case $variant in =20 ) ;; + llvm) + opts=3D( -S ) # no option stacking + args=3D( # start over from an empty array + '-aarch64-neon-syntax=3D[chose style of NEON code = (AArch64)]:style:(generic apple)' + '-arch=3D[w -macho: select arch from a fat binary]:arch:(i386 = x86_64)' + '-arch-name=3D[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=3D[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=3D[w -macho -g: use the specified .dSYM file for debug = info]:dsym file:_files' + '-dwarf=3D[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=3D[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=3D[target specific attributes]:attributes' + '-mcpu=3D[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=3D[seed for the random number generator]:seed' + '-s[display contents of each section]' + '*'{-section=3D,-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=3D[start disassembly at the specified = address]:address' + '-stop-address=3D[stop disassembly at the specified = address]:address' + '-t[display the symbol talbe]' + '-time-passes[time each pass, print elapsed time on exit]' + '-triple=3D[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=3D[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 =20 -_arguments -s -S : "$args[@]" $files +_arguments $opts -C : "$args[@]" $files && return 0 =20 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 =20 =20