Re: [PATCH 1/2] libtraceevent: Add loading of BTF to the tep handle

Steven Rostedt <[email protected]> Wed, 12 Nov 2025 15:59:54 -0500
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
On Mon, 4 Aug 2025 15:18:41 +0100
Douglas Raillard <[email protected]> wrote:

> > 
> > You meant to the "arg" passed in?  
> 
> Yes, something like that:
> 
>    unsigned long long mask = (1 << BTF_INT_BITS(encode)) - 1;
>    unsigned long long shift = BTF_INT_OFFSET(encode);
>    arg = (arg >> shift) & mask;
> 
> I suppose that how BTF_INT_OFFSET() is to be used depends on endianness, and I'm not
> sure what is the endianness of the arg value. t->size would probably be involved as
> well in the big endian case: https://docs.kernel.org/bpf/btf.html#btf-kind-int

I implemented this and got a lot of BTF_INT_BITS(encode) = 0, where it
would not print anything. Then I realized this isn't really needed. Isn't
this for bit fields in a structure? How would bit size matter for function
parameters?

-- Steve