diff options
author | Quentin Monnet <quentin@isovalent.com> | 2023-04-05 16:21:18 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-04-06 07:27:27 +0300 |
commit | 9b79f02722bbf24f060b2ab79513ad6e22c8e2f0 (patch) | |
tree | e998630eabdb43b4da2b0c5968d2e1c421053b61 /tools/bpf/bpftool/bash-completion | |
parent | 05a06be722896e51f65dbbb6a3610f85a8353d6b (diff) | |
download | linux-9b79f02722bbf24f060b2ab79513ad6e22c8e2f0.tar.xz |
bpftool: Support "opcodes", "linum", "visual" simultaneously
When dumping a program, the keywords "opcodes" (for printing the raw
opcodes), "linum" (for displaying the filename, line number, column
number along with the source code), and "visual" (for generating the
control flow graph for translated programs) are mutually exclusive. But
there's no reason why they should be. Let's make it possible to pass
several of them at once. The "file FILE" option, which makes bpftool
output a binary image to a file, remains incompatible with the others.
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20230405132120.59886-6-quentin@isovalent.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/bpf/bpftool/bash-completion')
-rw-r--r-- | tools/bpf/bpftool/bash-completion/bpftool | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index a3cb07172789..69c64dc18b1d 100644 --- a/tools/bpf/bpftool/bash-completion/bpftool +++ b/tools/bpf/bpftool/bash-completion/bpftool @@ -271,7 +271,7 @@ _bpftool() # Deal with simplest keywords case $prev in - help|hex|opcodes|visual|linum) + help|hex) return 0 ;; tag) @@ -369,13 +369,16 @@ _bpftool() return 0 ;; *) - _bpftool_once_attr 'file' + # "file" is not compatible with other keywords here + if _bpftool_search_list 'file'; then + return 0 + fi + if ! _bpftool_search_list 'linum opcodes visual'; then + _bpftool_once_attr 'file' + fi + _bpftool_once_attr 'linum opcodes' if _bpftool_search_list 'xlated' && [[ "$json" == 0 ]]; then - COMPREPLY+=( $( compgen -W 'opcodes visual linum' -- \ - "$cur" ) ) - else - COMPREPLY+=( $( compgen -W 'opcodes linum' -- \ - "$cur" ) ) + _bpftool_once_attr 'visual' fi return 0 ;; |