Re: [PATCH v2 bpf-next 05/13] bpftool: support displaying raw split BTF using base BTF section as base

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 24, 2024 at 8:49 AM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote:
>
> If no base BTF can be found, fall back to checking for the .BTF.base
> section and use it to display split BTF.
>
> Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
> ---
>  tools/bpf/bpftool/btf.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
> index 91fcb75babe3..2e8bd2c9f0a3 100644
> --- a/tools/bpf/bpftool/btf.c
> +++ b/tools/bpf/bpftool/btf.c
> @@ -631,6 +631,15 @@ static int do_dump(int argc, char **argv)
>                         base = get_vmlinux_btf_from_sysfs();
>
>                 btf = btf__parse_split(*argv, base ?: base_btf);
> +               /* Finally check for presence of base BTF section */
> +               if (!btf && !base && !base_btf) {
> +                       LIBBPF_OPTS(btf_parse_opts, optp);
> +
> +                       optp.btf_sec = BTF_BASE_ELF_SEC;

you can do this declaratively:

LIBBPF_OPTS(btf_parse_opts, optp, .btf_sec = BTF_BASE_ELF_SEC);


> +                       base_btf = btf__parse_opts(*argv, &optp);
> +                       if (base_btf)
> +                               btf = btf__parse_split(*argv, base_btf);
> +               }
>                 if (!btf) {
>                         err = -errno;
>                         p_err("failed to load BTF from %s: %s",
> --
> 2.31.1
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux