From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Douglas RAILLARD <douglas.raillard@arm.com>
Cc: rostedt@goodmis.org, Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: Fix synth event printk format for str fields
Date: Wed, 19 Mar 2025 21:18:58 +0900 [thread overview]
Message-ID: <20250319211858.6d8166e3fb202e6e5a658557@kernel.org> (raw)
In-Reply-To: <20250318180939.227696-1-douglas.raillard@arm.com>
Hi,
On Tue, 18 Mar 2025 18:09:38 +0000
Douglas RAILLARD <douglas.raillard@arm.com> wrote:
> From: Douglas Raillard <douglas.raillard@arm.com>
>
> The printk format for synth event uses "%.*s" to print string fields,
> but then only passes the pointer part as var arg.
>
> Add the missing precision var arg.
I'm not sure what you want to. Would you mean showing the string length too?
But I think actual output(*) shows only string, right?
(*) the output data which can be read from `trace` file.
Thank you,
>
> Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
> ---
> kernel/trace/trace_events_synth.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
> index e3f7d09e5512..274b9b1d9f7d 100644
> --- a/kernel/trace/trace_events_synth.c
> +++ b/kernel/trace/trace_events_synth.c
> @@ -620,7 +620,8 @@ static int __set_synth_event_print_fmt(struct synth_event *event,
> if (event->fields[i]->is_string &&
> event->fields[i]->is_dynamic)
> pos += snprintf(buf + pos, LEN_OR_ZERO,
> - ", __get_str(%s)", event->fields[i]->name);
> + ", (int)__get_dynamic_array_len(%s), __get_str(%s)",
> + event->fields[i]->name, event->fields[i]->name);
> else if (event->fields[i]->is_stack)
> pos += snprintf(buf + pos, LEN_OR_ZERO,
> ", __get_stacktrace(%s)", event->fields[i]->name);
> --
> 2.43.0
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2025-03-19 12:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 18:09 [PATCH] tracing: Fix synth event printk format for str fields Douglas RAILLARD
2025-03-19 12:18 ` Masami Hiramatsu [this message]
2025-03-19 14:34 ` Douglas Raillard
2025-03-24 5:45 ` Masami Hiramatsu
2025-03-24 10:18 ` Douglas Raillard
2025-03-24 13:40 ` Steven Rostedt
2025-03-24 21:12 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250319211858.6d8166e3fb202e6e5a658557@kernel.org \
--to=mhiramat@kernel.org \
--cc=douglas.raillard@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox