libtraceevent | API clarifications needed

"MOESSBAUER, Felix" <[email protected]> Mon, 1 Dec 2025 15:38:32 +0000
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
Dear tracers,

while continuing the development of the ftrace-to-ctf converter [1], I
noticed the following in the traceevent API that needs some
clarification:

half-length signed integers

What is the recommended way to read a field value that is a half-length
(i.e. 32 bit) or smaller signed integer? Currently, I'm using the
tep_get_field_val which returns the value as unsigned long long
(usually 8 byte). This value contains the raw bits (endian-corrected),
hence a int32_t (-1) is represented as FFFF FFFF. I'm currently
manually converting this, but I'm wondering if there is a better way of
doing it.


arrays of integers

The only API I found to read int[x] types (arrays of integers) is
tep_get_field_raw. However, this just gives me the raw bytes of the
trace buffer. Does it mean I need to take care of endian correctness?
Are trace buffers always little-endian, or is this an implementation
detail?

unbounded arrays

These arrays have both their size= and arraylen= attributes set to 0.
How do I know how wide the types are? Especially given that the type
names (e.g. unsigned long) are platform specific? An example event is
"funcgraph_entry" with format ... "field:unsigned long args[];    
offset:24;      size:0; signed:0;"

symbolic fields

How to get the symbolic representation of fields that are marked
TEP_FIELD_IS_SYMBOLIC (example: softirq_entry->vec)? I tried
tep_print_field_content, but this converts the data to a string integer
instead of the symbolic representation (e.g. I get a "0" instead of a 
"HI").

[1] https://github.com/siemens/bt2-ftrace-to-ctf

Best regards,
Felix

-- 
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany