Commit 775bc8ad authored by Quentin Monnet's avatar Quentin Monnet Committed by Daniel Borkmann
Browse files

tools: bpftool: add -d option to get debug output from libbpf



libbpf has three levels of priority for output messages: warn, info,
debug. By default, debug output is not printed to the console.

Add a new "--debug" (short name: "-d") option to bpftool to print libbpf
logs for all three levels.

Internally, we simply use the function provided by libbpf to replace the
default printing function by one that prints logs regardless of their
level.

v2:
- Remove the possibility to select the log-levels to use (v1 offered a
  combination of "warn", "info" and "debug").
- Rename option and offer a short name: -d|--debug.
- Add option description to all bpftool manual pages (instead of
  bpftool-prog.rst only), as all commands use libbpf.

Signed-off-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent d98363b5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -72,6 +72,10 @@ OPTIONS
	-p, --pretty
		  Generate human-readable JSON output. Implies **-j**.

	-d, --debug
		  Print all logs available from libbpf, including debug-level
		  information.

EXAMPLES
========
**# bpftool btf dump id 1226**
+4 −0
Original line number Diff line number Diff line
@@ -113,6 +113,10 @@ OPTIONS
	-f, --bpffs
		  Show file names of pinned programs.

	-d, --debug
		  Print all logs available from libbpf, including debug-level
		  information.

EXAMPLES
========
|
+4 −0
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@ OPTIONS
	-p, --pretty
		  Generate human-readable JSON output. Implies **-j**.

	-d, --debug
		  Print all logs available from libbpf, including debug-level
		  information.

SEE ALSO
========
	**bpf**\ (2),
+4 −0
Original line number Diff line number Diff line
@@ -152,6 +152,10 @@ OPTIONS
		  Do not automatically attempt to mount any virtual file system
		  (such as tracefs or BPF virtual file system) when necessary.

	-d, --debug
		  Print all logs available from libbpf, including debug-level
		  information.

EXAMPLES
========
**# bpftool map show**
+4 −0
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@ OPTIONS
	-p, --pretty
		  Generate human-readable JSON output. Implies **-j**.

	-d, --debug
		  Print all logs available from libbpf, including debug-level
		  information.

EXAMPLES
========

Loading