about summary refs log tree commit diff
path: root/Completion/Unix/Command/_readelf
blob: 42094742e09e5abef6591327ef0630bc9ed1e108 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#compdef readelf eu-readelf

local variant args sections

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]'
  '(-g --section-groups)'{-g,--section-groups}'[show section groups]'
  '(-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]'
  '(-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 U u T g A c k K)'
  '--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 addr cu_index links follow-links)'
  '(-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:_object_files"
)

case $variant in
  elftoolchain|binutils)
    args+=(
      '(-t --section-details)'{-t,--section-details}'[show section details]'
      '(-e --headers)'{-e,--headers}'[show file, program and sections headers]'
      '(-s --syms --symbols)'{-s,--syms,--symbols}'[show symbol table]'
      '(-n --notes)'{-n,--notes}'[show core notes (if present)]'
      '(-u --unwind)'{-u,--unwind}'[show unwind info (if present)]'
      '(-D --use-dynamic)'{-D,--use-dynamic}'[use dynamic section info when showing symbols]'
    )
  ;|
  elfutils|binutils)
    args+=(
      '--dyn-syms[show dynamic symbol table]'
    )
  ;|
  binutils)
    args+=(
      \*{-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'
      '--ctf=[display compact C type format info from section]:section'
      '--ctf-parent=[use specified section as the CTF parent]:section'
      '--ctf-symbols=[use specified section as the CTF external symbol table]:section'
      '--ctf-strings=[use specified section as the CTF external string table]:section'
    )
  ;;
  elfutils)
    args+=(
      '--dwarf-skeleton=[find skeleton compile units (with -w)]:file:_files'
      '--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]"
      '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]'
      '(--symbols)-s[show symbol table]'
      '(-s)--symbols=-[show symbol table]::section:(.dynsym .symtab)'
      '(--notes)-n[show core notes (if present)]'
      '(-n)--notes=-[show core notes (if present)]::section'
    )
  ;;
esac

_arguments -s "$args[@]"