* objdump completion should suggest more filenames
@ 2017-09-03 19:36 Marc Aldorasi
2017-09-04 1:29 ` Marc Aldorasi
0 siblings, 1 reply; 3+ messages in thread
From: Marc Aldorasi @ 2017-09-03 19:36 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 961 bytes --]
zsh will not complete filenames for objdump unless the last argument is a
single option. Instead, it will only autocomplete from the objdump options
list. For example:
objdump <tab> (no options listed) will only complete options
objdump -d <tab> (single option at end) will complete filenames, as expected
objdump -dC (multiple options at end) will only complete options
objdump -d -C <tab> (single option at end) will complete filenames, as
expected
objdump -d -dC (multiple options at end) will only complete options
objdump -dC -d <tab> (single option at end) will complete filenames, as
expected
objdump -d a.out <tab> (filename at end) will only complete options
objdump -d -- <tab> (option separator at end) will only complete options
zsh should instead allow filename completions anywhere in the command, and
shouldn't allow option completions after --
This happens with both zsh 5.4.2 on x86_64 linux and zsh 5.4.1 on aarch64
android linux.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: objdump completion should suggest more filenames
2017-09-03 19:36 objdump completion should suggest more filenames Marc Aldorasi
@ 2017-09-04 1:29 ` Marc Aldorasi
2017-09-04 8:37 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: Marc Aldorasi @ 2017-09-04 1:29 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]
Looking into it, this appears to be because objdump doesn't have
custom completion defined; zsh just attempts to parse the help, and
apparently it doesn't do the best job of it. I've attached a custom
completion file that works properly; please accept it. If there are
any questions or feedback, add me to the recipients list; I'm not
subscribed to the list, so I won't get normal replies.
On Sun, Sep 3, 2017 at 3:36 PM, Marc Aldorasi <m101010a@gmail.com> wrote:
> zsh will not complete filenames for objdump unless the last argument is a
> single option. Instead, it will only autocomplete from the objdump options
> list. For example:
>
> objdump <tab> (no options listed) will only complete options
>
> objdump -d <tab> (single option at end) will complete filenames, as expected
>
> objdump -dC (multiple options at end) will only complete options
>
> objdump -d -C <tab> (single option at end) will complete filenames, as
> expected
>
> objdump -d -dC (multiple options at end) will only complete options
>
> objdump -dC -d <tab> (single option at end) will complete filenames, as
> expected
>
> objdump -d a.out <tab> (filename at end) will only complete options
>
> objdump -d -- <tab> (option separator at end) will only complete options
>
> zsh should instead allow filename completions anywhere in the command, and
> shouldn't allow option completions after --
>
> This happens with both zsh 5.4.2 on x86_64 linux and zsh 5.4.1 on aarch64
> android linux.
[-- Attachment #2: _objdump --]
[-- Type: application/octet-stream, Size: 5821 bytes --]
#compdef objdump eu-objdump
local args files variant context state state_descr line
typeset -A opt_args
files='*:object file:_object_files'
_pick_variant -r variant binutils=GNU elfutils=elfutils unix --version
args=(
"(-d --disassemble)"{-d,--disassemble}"[Display assembler code of executable sections]"
"(-r --reloc)"{-r,--reloc}"[Display relocation information]"
"(-s --full-contents)"{-s,--full-contents}"[Display the full contents of all sections requested]"
"*"{-j+,--section=}"[Only display information for section]:section:(.bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text)"
)
case $variant in
binutils)
args+=(
"(-a --archive-headers)"{-a,--archive-headers}"[Display archive header information]"
"(-f --file-headers)"{-f,--file-headers}"[Display the contents of the overall file header]"
"(-p --private-headers)"{-p,--private-headers}"[Display object format specific file header contents]"
"*"{-P,--private=}"[Display object format specific contents]:option"
"(-h --section-headers --headers)"{-h,--section-headers,--headers}"[Display the contents of the section headers]"
"(-x --all-headers)"{-x,--all-headers}"[Display the contents of all headers]"
"(-D --disassemble-all)"{-D,--disassemble-all}"[Display assembler contents of all sections]"
"(-S --source)"{-S,--source}"[Intermix source code with disassembly]"
"(-g --debugging)"{-g,--debugging}"[Display debug information in object file]"
"(-e --debugging-tags)"{-e,--debugging-tags}"[Display debug information using ctags style]"
"(-G --stabs)"{-G,--stabs}"[Display (in raw form) any STABS info in the file]"
"*-W-[Display DWARF info in the file]::dwarf section:->short_dwarf_names"
"*--dwarf=-[Display DWARF info in the file]::dwarf section:->dwarf_names"
"(-t --syms)"{-t,--syms}"[Display the contents of the symbol table(s)]"
"(-T --dynamic-syms)"{-T,--dynamic-syms}"[Display the contents of the dynamic symbol table]"
"(-R --dynamic-reloc)"{-R,--dynamic-reloc}"[Display the dynamic relocation entries in the file]"
#@<file> Read options from <file>
"(- *)"{-v,--version}"[Display this program's version number]"
"(- *)"{-i,--info}"[List object formats and architectures supported]"
"(- *)"{-H,--help}"[Display this information]"
"(-b --target)"{-b+,--target=}"[Specify the target object format]:bfdname:->bfdname"
"(-m --architecture)"{-m+,--architecture=}"[Specify the target architecture]:machine:->machine"
"*"{-M+,--disassembler-options=}"[Pass text OPT on to the disassembler]:opt:->disassembler_options"
"(-E --endian)-E+[Assume endianess when disassembling]:endianess:((B\:\"Assume big endian format when disassembling\" L\:\"Assume little endian format when disassembling\"))"
"(-E --endian)--endian=[Assume endianess when disassembling]:endianess:((big\:\"Assume big endian format when disassembling\" little\:\"Assume little endian format when disassembling\"))"
"--file-start-context[Include context from start of file (with -S)]"
"*"{-I+,--include=}"[Add directory to search list for source files]:directory:_files -/"
"(-l --line-numbers)"{-l,--line-numbers}"[Include line numbers and filenames in output]"
"(-F --file-offsets)"{-F,--file-offsets}"[Include file offsets when displaying information]"
"(-C --demangle)-C[Decode mangled/processed symbol names]"
"(-C --demangle)--demangle=-[Decode mangled/processed symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)"
"(-w --wide)"{-w,--wide}"[Format output for more than 80 columns]"
"(-z --disassemble-zeroes)"{-z,--disassemble-zeroes}"[Do not skip blocks of zeroes when disassembling]"
"--start-address=[Only process data whose address is >= ADDR]:addr"
"--stop-address=[Only process data whose address is <= ADDR]:addr"
"--prefix-addresses[Print complete address alongside disassembly]"
"(--show-raw-insn --no-show-raw-insn)"--{,no-}show-raw-insn"[Display hex alongside symbolic disassembly]"
"--insn-width=[Display WIDTH bytes on a single line for -d]:width"
"--adjust-vma=[Add offset to all displayed section addresses]:offset"
"--special-syms[Include special symbols in symbol dumps]"
"--prefix=[Add prefix to absolute paths for -S]:prefix"
"--prefix-strip=[Strip initial directory names for -S]:level"
"--dwarf-depth=[Do not display DIEs at depth N or greater]:n"
"--dwarf-start=[Display DIEs starting with N, at the same depth or deeper]:n"
"--dwarf-check[Make additional dwarf internal consistency checks]"
)
;;
elfutils)
args+=(
"--color=-[Colorize the output]::when:(always auto never)"
"(- *)"{-\?,--help}"[Display help]"
"(- *)--usage[Display usage]"
"(- *)"{-V,--version}"[Display program version]"
)
;;
esac
_arguments -s -S : "$args[@]" $files
case "$state" in
short_dwarf_names)
_values -s "" "dwarf section" "l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" "r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" "o[loc]" "R[Ranges]" "t[pubtypes]"
;;
dwarf_names)
_values -s , "dwarf section" rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index
;;
bfdname)
_values "object format" "${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported targets:*}##*: }"
;;
machine)
_values "machine architecture" "${(@)${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported architectures:*}##*: }//:/\\:}"
;;
disassembler_options)
_values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}"
;;
esac
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: objdump completion should suggest more filenames
2017-09-04 1:29 ` Marc Aldorasi
@ 2017-09-04 8:37 ` Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2017-09-04 8:37 UTC (permalink / raw)
To: Marc Aldorasi, zsh-workers
On Sun, 3 Sep 2017 21:29:48 -0400
Marc Aldorasi <m101010a@gmail.com> wrote:
> Looking into it, this appears to be because objdump doesn't have
> custom completion defined; zsh just attempts to parse the help, and
> apparently it doesn't do the best job of it. I've attached a custom
> completion file that works properly; please accept it. If there are
> any questions or feedback, add me to the recipients list; I'm not
> subscribed to the list, so I won't get normal replies.
Thanks, I've updated this. I use it occasionally, but it sounds like you
use it a lot more.
pws
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-04 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-03 19:36 objdump completion should suggest more filenames Marc Aldorasi
2017-09-04 1:29 ` Marc Aldorasi
2017-09-04 8:37 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).