All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH 0/2] libtraceevent: Allow %pIS to work with dynamic arrays
Date: Mon, 10 Jan 2022 19:17:03 -0500	[thread overview]
Message-ID: <20220111001705.692692-1-rostedt@goodmis.org> (raw)

Chuck Lever reported that adding the following:

#define field_sockaddr(field, len)  __dynamic_array(u8, field, len)
#define assign_sockaddr(dest, src, len)  memcpy(__get_dynamic_array(dest), src, len)
#define __get_sockaddr(field)  ((struct sockaddr *)__get_dynamic_array(field))

TRACE_EVENT(sockaddr_example,
        TP_PROTO(
                const struct sockaddr *sap,
                size_t salen
        ),  
        TP_ARGS(sap, salen),
        TP_STRUCT__entry(
                __field_sockaddr(addr, salen)
        ),  
        TP_fast_assign(
                __assign_sockaddr(addr, sap, salen);
        ),  
        TP_printk("addr=%pIS", __get_sockaddr(addr))
);

Causes trace-cmd to report:

  "addr=ARG TYPE NOT FIELD BUT 7"

Which is not only unwanted, but rather unhelpful.

Fix it to allow %pIS to work with dynamic arrays, and also allow all fields to
still work if they are typecasted.

Link: https://lore.kernel.org/all/164182978641.8391.8277203495236105391.stgit@bazille.1015granger.net/

Steven Rostedt (2):
  libtraceevent: Do not fail field parsing if field has typecast
  libtraceevent: Allow ipsa arg to use dynamic arrays

 src/event-parse.c | 70 ++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 54 insertions(+), 16 deletions(-)

-- 
2.33.0


             reply	other threads:[~2022-01-11  0:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  0:17 Steven Rostedt [this message]
2022-01-11  0:17 ` [PATCH 1/2] libtraceevent: Do not fail field parsing if field has typecast Steven Rostedt
2022-01-11  0:17 ` [PATCH 2/2] libtraceevent: Allow ipsa arg to use dynamic arrays Steven Rostedt
2022-01-11  0:37 ` [PATCH 0/2] libtraceevent: Allow %pIS to work with " 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=20220111001705.692692-1-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.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 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.