Re: [PATCH v2 2/2] tracing: Use seq_buf_hex_dump() to dump buffers

From: Piotr Maziarz
Date: Tue Nov 26 2019 - 09:53:36 EST


On 2019-11-13 22:09, Steven Rostedt wrote:
OK, so the __print_hex_dump() will be exported to the format files.

Would you be willing to add a function to handle __print_hex_dump() in
tools/lib/traceevent/event-parse.c, like __print_flags(),
__print_symbolic(), and other __print_*() functions are handled. This
will allow trace-cmd and perf to be able to parse the data when you
used it via the userspace tools.

This can be a separate patch, but ideally before any trace events start
using this.

Thanks,

-- Steve


Hello Steven,

I'm writing handle in event-parse and I came across some technical problems. I have an event which print function looks like that:
TP_printk("%s",
__print_hex_dump("", DUMP_PREFIX_OFFSET, 16, 4,
__get_dynamic_array(buf),
__get_dynamic_array_len(buf), false))
It works properly when printing events to debugfs.
I'm testing my implementation with trace-cmd and it has problem with parsing DUMP_PREFIX_OFFSET and false (I'm using alloc_and_process_delim()). Instead of having numerical values tep_print_args are of type TEP_PRINT_ATOM and have char array "DUMP_PREFIX_OFFSET" or "true".
Am I doing something incorrect? Parsing it this way is problematic because instead of false someone may use 0 or logic expression. And writing it to support all possible scenarios may be tedious and prone to errors.

Best regards,
Piotr Maziarz