From: Steven Rostedt <rostedt@goodmis.org>
To: Javi Merino <javi.merino@arm.com>
Cc: linux-kernel@vger.kernel.org, Dave Martin <Dave.Martin@arm.com>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: [RESEND PATCH v2 1/2] tracing: Add array printing helpers
Date: Thu, 15 Jan 2015 21:22:02 -0500 [thread overview]
Message-ID: <20150115212202.7939072a@grimm.local.home> (raw)
In-Reply-To: <1421340659-18063-1-git-send-email-javi.merino@arm.com>
On Thu, 15 Jan 2015 16:50:58 +0000
Javi Merino <javi.merino@arm.com> wrote:
> +const char *
> +ftrace_print_array_seq(struct trace_seq *p, const void *buf, int
> buf_len,
> + size_t el_size)
> +{
> + const char *ret = trace_seq_buffer_ptr(p);
> + const char *prefix = "";
> + void *ptr = (void *)buf;
> +
> + trace_seq_putc(p, '{');
> +
> + while (ptr < buf + buf_len) {
> + switch (el_size) {
> + case 8:
> + trace_seq_printf(p, "%s0x%x", prefix,
> + *(u8 *)ptr);
> + break;
> + case 16:
> + trace_seq_printf(p, "%s0x%x", prefix,
> + *(u16 *)ptr);
> + break;
> + case 32:
> + trace_seq_printf(p, "%s0x%x", prefix,
> + *(u32 *)ptr);
> + break;
> + case 64:
> + trace_seq_printf(p, "%s0x%llx", prefix,
> + *(u64 *)ptr);
> + break;
> + default:
> + BUG();
BUG() is a bit extreme don't you think? I'm not sure it even deserves a
WARN_ON().
I would suggest doing:
trace_seq_printf(p, "BAD SIZE:%d 0x%x", el_size,
*(u8 *)ptr);
el_size = 8;
No need to go crashing the kernel or even messing with dmesg over
somebody's tracepoint mistake.
The rest looks fine.
> + }
> + prefix = ",";
> + ptr += el_size / 8;
> + }
> +
> + trace_seq_putc(p, '}');
> + trace_seq_putc(p, 0);
I need to add a trace_seq_terminate() for this.
-- Steve
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(ftrace_print_array_seq);
> +
> int ftrace_raw_output_prep(struct trace_iterator *iter,
> struct trace_event *trace_event)
> {
next prev parent reply other threads:[~2015-01-16 2:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-15 16:50 [RESEND PATCH v2 1/2] tracing: Add array printing helpers Javi Merino
2015-01-15 16:50 ` [RESEND PATCH v2 2/2] tools lib traceevent: Add support for __print_array() Javi Merino
2015-01-16 2:35 ` Steven Rostedt
2015-01-16 11:18 ` Javi Merino
2015-01-16 2:22 ` Steven Rostedt [this message]
2015-01-16 10:14 ` [RESEND PATCH v2 1/2] tracing: Add array printing helpers Javi Merino
2015-01-16 13:30 ` 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=20150115212202.7939072a@grimm.local.home \
--to=rostedt@goodmis.org \
--cc=Dave.Martin@arm.com \
--cc=javi.merino@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.