Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/bpf_inspect.py: show used maps and subprogs for bpf prog #408

Merged
merged 2 commits into from
Jul 11, 2024

Conversation

Asphaltt
Copy link
Contributor

@Asphaltt Asphaltt commented Jun 25, 2024

Show used maps and subprogs for bpf prog.

$ sudo drgn ./contrib/bpf_inspect.py p --show-details
     2: BPF_PROG_TYPE_TRACING            hid_tail_call
	used map:      2: BPF_MAP_TYPE_PROG_ARRAY          hid_jmp_table
  2295: BPF_PROG_TYPE_EXT                entry                            tail_call_reachable
	used map:   4208: BPF_MAP_TYPE_ARRAY               tailcall.bss
	used map:   4207: BPF_MAP_TYPE_PROG_ARRAY          jmp_table
	func[ 0]:      0: BPF_PROG_TYPE_EXT                entry                            tail_call_reachable
	func[ 1]:      0: BPF_PROG_TYPE_EXT                subprog_tail
  2400: BPF_PROG_TYPE_EXT                entry                            tail_call_reachable
	used map:   4248: BPF_MAP_TYPE_ARRAY               tailcall.bss
	used map:   4247: BPF_MAP_TYPE_PROG_ARRAY          jmp_table
	func[ 0]:      0: BPF_PROG_TYPE_EXT                entry                            tail_call_reachable
	func[ 1]:      0: BPF_PROG_TYPE_EXT                subprog_tail
  4235: BPF_PROG_TYPE_SCHED_CLS          entry1
	used map:   5092: BPF_MAP_TYPE_ARRAY               .rodata
	func[ 0]:      0: BPF_PROG_TYPE_SCHED_CLS          entry1
	func[ 1]:      0: BPF_PROG_TYPE_SCHED_CLS          subprog1
	func[ 2]:      0: BPF_PROG_TYPE_SCHED_CLS          subprog2

Signed-off-by: Leon Hwang hffilwlqm@gmail.com

Unlike `bpftool p` to show bpf map ids, `drgn contrib/bpf_inspect.py p
--show-details` is able to show more bpf map info, which is useful to
identify the used `.rodata` map.

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Show subprog list when `--show-details`.

It's useful to inspect subprog function name.

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
@Asphaltt Asphaltt force-pushed the feature/bpf_inspect/bpf-prog-used-maps branch from 373db9c to 7ff4906 Compare June 25, 2024 15:43
@osandov osandov merged commit d564e96 into osandov:main Jul 11, 2024
32 of 33 checks passed
@osandov
Copy link
Owner

osandov commented Jul 11, 2024

LGTM, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants