Re: libbpf API to extract bpf_line_info from a ELF file?

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

 



On Wed, Feb 16, 2022 at 8:59 AM Alan Jowett <Alan.Jowett@xxxxxxxxxxxxx> wrote:
>
> Libbpf folks,
>
> Is there already an API or are there plans to add a supported API to extract bpf_line_info from an ELF file?

No, there is currently not. And as you saw, few APIs that were exposed
are deprecated. It is a good idea to let users work with BTF.ext more
directly, we need to carefully design the API to make it both
user-friendly, efficient, and extensible.

>
> The closest I can find is:
> LIBBPF_API LIBBPF_DEPRECATED("btf_ext__reloc_line_info was never meant as a public API and has wrong assumptions embedded in it; it will be removed in the future libbpf versions")
> int btf_ext__reloc_line_info(const struct btf *btf,
>                  const struct btf_ext *btf_ext,
>                  const char *sec_name, __u32 insns_cnt,
>                  void **line_info, __u32 *cnt);
>
> But this is marked as deprecated.
>
> Use case:
> Prevail ebpf-verifier emits "pretty printed" BPF instructions in various use cases (verification failure, dump of assembly, and others). I was planning on augmenting it so that it would also emit the file/line number to make debugging verifier failures easier for developers.
>
> I ended up writing my own code to extract bpf_line_info from a .BTF and .BTF.ext sections, but ideally, I would want to use the parser in libbpf.
>
> Regards,
> Alan Jowett




[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