Re: [PATCH v3 0/3] tracing: Add dynamic strings for synthetic events
From: Steven Rostedt
Date: Fri Oct 02 2020 - 20:55:42 EST
On Thu, 1 Oct 2020 16:46:43 -0500
Tom Zanussi <zanussi@xxxxxxxxxx> wrote:
> Hi,
>
> This is v3 of the dynamic string support for synthetic events.
>
> No code changes since v2, just added Fixes: tag for 'tracing: Fix
> parse_synth_field() error handling' as suggested by Masami along with
> his Reviewed-by, and Axel's Tested-bys.
>
I added the following to make it work with trace-cmd. Dynamic strings
must have __get_str() for events in the print_fmt otherwise it can't be
parsed correctly.
-- Steve
diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 4b3ec570147a..24bc6d61aa40 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -489,8 +489,13 @@ static int __set_synth_event_print_fmt(struct synth_event *event,
pos += snprintf(buf + pos, LEN_OR_ZERO, "\"");
for (i = 0; i < event->n_fields; i++) {
- pos += snprintf(buf + pos, LEN_OR_ZERO,
- ", REC->%s", event->fields[i]->name);
+ if (event->fields[i]->is_dynamic &&
+ event->fields[i]->is_dynamic)
+ pos += snprintf(buf + pos, LEN_OR_ZERO,
+ ", __get_str(%s)", event->fields[i]->name);
+ else
+ pos += snprintf(buf + pos, LEN_OR_ZERO,
+ ", REC->%s", event->fields[i]->name);
}
#undef LEN_OR_ZERO