osandov / drgn

Programmable debugger
Other
1.78k stars 165 forks source link

contrib/bpf_inspect.py: list bpf links #402

Closed Asphaltt closed 6 months ago

Asphaltt commented 6 months ago

Like list_bpf_progs() and list_bpf_maps(), it's easy to implement list_bpf_links().

Here's an use example:

drgn ./contrib/bpf_inspect.py l
     1: BPF_LINK_TYPE_TRACING            prog:      2: BPF_PROG_TYPE_TRACING            hid_tail_call
   931: BPF_LINK_TYPE_XDP                prog:   2056: BPF_PROG_TYPE_XDP                dummy
   932: BPF_LINK_TYPE_TRACING            prog:   2060: BPF_PROG_TYPE_TRACING            fentry_xdp
   933: BPF_LINK_TYPE_TRACING            prog:   2061: BPF_PROG_TYPE_TRACING            fexit_xdp