libtraceevent(3)

# libtraceevent(3) Manual Page

## NAME

tep_load_btf, tep_btf_print_args - Load BTF file and use it to pretty print function arguments.

## SYNOPSIS

    #include <event-parse.h>

    int tep_load_btf(struct tep_handle *tep, void *raw_data, size_t data_size);
    int tep_btf_print_args(struct tep_handle *tep, struct trace_seq *s, void *args,
                           int nmem, int size, const char *func);

## DESCRIPTION

If the Linux kernel has BTF configured, then a binary file will exist in the path of /sys/kernel/btf/vmlinux. If this file is read into memory and passed to tep_load_btf() function, then it will be used to parse the arguments of a given function, if that function data is found within the BTF file.

The tep_load_btf() takes the tep handle and will load the raw_data into it. The data_size should be set to the size of the content in raw_data.

The tep_btf_print_args() takes a tep handle, a trace_seq s pointer (that was initialized by trace_seq_init(3)), an args array that holds either 4 byte or 8 byte values, the nmem that is the number of values in the args parameter, a size that is either 4 or 8 to denote the size of each value in args, and a func string that is the name of the function to find the BTF information to use for parsing. If BTF is not loaded or the func name is not found it will just print a hex value of all the args into the s descriptor.

## RETURN VALUE

tep_load_btf() function returns 0 on success. It returns -1 on failure and the raw_data will need to be freed by the caller.

tep_btf_print_args() returns 0 on success and -1 on failure, which happens if the size is not valid or the BTF file that was loaded is corrupted.

## EXAMPLE

## FILES

    event-parse.h
            Header file to include in order to have access to the library APIs.
    -ltraceevent
            Linker switch to add when building a program that uses the library.

## SEE ALSO

libtraceevent(3), trace-cmd(1)

## AUTHOR

    Steven Rostedt <rostedt@goodmis.org>, author of libtraceevent.

## REPORTING BUGS

Report bugs to <linux-trace-devel@vger.kernel.org>

## LICENSE

libtraceevent is Free Software licensed under the GNU LGPL 2.1

## RESOURCES

https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/