diff options
Diffstat (limited to 'tools/bpf/bpftool/main.c')
-rw-r--r-- | tools/bpf/bpftool/main.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 1ac1fc520e6a..4879f6395c7e 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <string.h> | 10 | #include <string.h> |
11 | 11 | ||
12 | #include <bpf.h> | 12 | #include <bpf.h> |
13 | #include <libbpf.h> | ||
13 | 14 | ||
14 | #include "main.h" | 15 | #include "main.h" |
15 | 16 | ||
@@ -25,6 +26,7 @@ bool pretty_output; | |||
25 | bool json_output; | 26 | bool json_output; |
26 | bool show_pinned; | 27 | bool show_pinned; |
27 | bool block_mount; | 28 | bool block_mount; |
29 | bool verifier_logs; | ||
28 | int bpf_flags; | 30 | int bpf_flags; |
29 | struct pinned_obj_table prog_table; | 31 | struct pinned_obj_table prog_table; |
30 | struct pinned_obj_table map_table; | 32 | struct pinned_obj_table map_table; |
@@ -77,6 +79,13 @@ static int do_version(int argc, char **argv) | |||
77 | return 0; | 79 | return 0; |
78 | } | 80 | } |
79 | 81 | ||
82 | static int __printf(2, 0) | ||
83 | print_all_levels(__maybe_unused enum libbpf_print_level level, | ||
84 | const char *format, va_list args) | ||
85 | { | ||
86 | return vfprintf(stderr, format, args); | ||
87 | } | ||
88 | |||
80 | int cmd_select(const struct cmd *cmds, int argc, char **argv, | 89 | int cmd_select(const struct cmd *cmds, int argc, char **argv, |
81 | int (*help)(int argc, char **argv)) | 90 | int (*help)(int argc, char **argv)) |
82 | { | 91 | { |
@@ -317,6 +326,7 @@ int main(int argc, char **argv) | |||
317 | { "bpffs", no_argument, NULL, 'f' }, | 326 | { "bpffs", no_argument, NULL, 'f' }, |
318 | { "mapcompat", no_argument, NULL, 'm' }, | 327 | { "mapcompat", no_argument, NULL, 'm' }, |
319 | { "nomount", no_argument, NULL, 'n' }, | 328 | { "nomount", no_argument, NULL, 'n' }, |
329 | { "debug", no_argument, NULL, 'd' }, | ||
320 | { 0 } | 330 | { 0 } |
321 | }; | 331 | }; |
322 | int opt, ret; | 332 | int opt, ret; |
@@ -332,7 +342,7 @@ int main(int argc, char **argv) | |||
332 | hash_init(map_table.table); | 342 | hash_init(map_table.table); |
333 | 343 | ||
334 | opterr = 0; | 344 | opterr = 0; |
335 | while ((opt = getopt_long(argc, argv, "Vhpjfmn", | 345 | while ((opt = getopt_long(argc, argv, "Vhpjfmnd", |
336 | options, NULL)) >= 0) { | 346 | options, NULL)) >= 0) { |
337 | switch (opt) { | 347 | switch (opt) { |
338 | case 'V': | 348 | case 'V': |
@@ -362,6 +372,10 @@ int main(int argc, char **argv) | |||
362 | case 'n': | 372 | case 'n': |
363 | block_mount = true; | 373 | block_mount = true; |
364 | break; | 374 | break; |
375 | case 'd': | ||
376 | libbpf_set_print(print_all_levels); | ||
377 | verifier_logs = true; | ||
378 | break; | ||
365 | default: | 379 | default: |
366 | p_err("unrecognized option '%s'", argv[optind - 1]); | 380 | p_err("unrecognized option '%s'", argv[optind - 1]); |
367 | if (json_output) | 381 | if (json_output) |