Skip to content

Libbpf userspace function bpf_prog_linfo__new

0.0.1

Get the line info for a BPF program.

Definition

struct bpf_prog_linfo * bpf_prog_linfo__new(const struct bpf_prog_info *info);

Parameters

  • info: BPF program info to get line info from

Returns

Pointer to the line info for the BPF program, or NULL on error.

struct bpf_prog_linfo

struct bpf_prog_linfo {
    void *raw_linfo;
    void *raw_jited_linfo;
    __u32 *nr_jited_linfo_per_func;
    __u32 *jited_linfo_func_idx;
    __u32 nr_linfo;
    __u32 nr_jited_func;
    __u32 rec_size;
    __u32 jited_rec_size;
};

raw_linfo

An array of line info records of type struct bpf_line_info. The instruction offset is that of the BPF program before loading.

#define BPF_LINE_INFO_LINE_NUM(line_col)    ((line_col) >> 10)
#define BPF_LINE_INFO_LINE_COL(line_col)    ((line_col) & 0x3ff)

struct bpf_line_info {
    __u32   insn_off;
    __u32   file_name_off;
    __u32   line_off;
    __u32   line_col;
};

raw_jited_linfo

An array of line info records of type struct bpf_line_info. The instruction offset is that of the JITed BPF program.

nr_jited_linfo_per_func

An array of the number of JITed line info records per function.

jited_linfo_func_idx

An array of the function index for each JITed line info record.

nr_linfo

The number of line info records.

nr_jited_func

The number of JITed functions.

rec_size

The size of each line info record. (in case the structure changes in the future)

jited_rec_size

The size of each JITed line info record. (in case the structure changes in the future)

Usage

Docs could be improved

This part of the docs is incomplete, contributions are very welcome

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome