From: Kris Van Hees <kris.van.hees@oracle.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH v7 1/7] usdt: have copy_args() count args while parsing them
Date: Tue, 5 Aug 2025 11:04:02 -0400 [thread overview]
Message-ID: <aJIdYmQRtsyB0cEj@oracle.com> (raw)
In-Reply-To: <20250730090148.2141954-2-alan.maguire@oracle.com>
This patch still does not address the fact that we would like to have probe
argument count and type (if possible) at the probe_info level, which is well
before the trmmpoline is generated. I'm posting a proposal for an alternative
patch that accomplishes that in a few (still testing).
Also, even without the arg info at probe_info level, this patch still would
unnecessarily set upp->sargc. Non-stapsdt probes already have that value, and
stapsdt probes do not need the value in your series.
On Wed, Jul 30, 2025 at 10:01:42AM +0100, Alan Maguire wrote:
> stapsdt probes do not include an argument count, so the only
> way to count them is to parse the parameter string. Adjust
> copy_args() to set upp->sargc while parsing upp->sargv.
>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---
> libdtrace/dt_prov_uprobe.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/libdtrace/dt_prov_uprobe.c b/libdtrace/dt_prov_uprobe.c
> index 8e7aa4b0..b974e94b 100644
> --- a/libdtrace/dt_prov_uprobe.c
> +++ b/libdtrace/dt_prov_uprobe.c
> @@ -1153,9 +1153,9 @@ static void enable_usdt(dtrace_hdl_t *dtp, dt_probe_t *prp)
> }
>
> /*
> - * Generate code that populates the probe arguments.
> + * Generate code that populates, counts the probe arguments.
> */
> -static void copy_args(dt_pcb_t *pcb, const dt_uprobe_t *upp)
> +static void copy_args(dt_pcb_t *pcb, dt_uprobe_t *upp)
> {
> dtrace_hdl_t *dtp = pcb->pcb_hdl;
> dt_irlist_t *dlp = &pcb->pcb_ir;
> @@ -1166,7 +1166,7 @@ static void copy_args(dt_pcb_t *pcb, const dt_uprobe_t *upp)
>
> assert(pvp != NULL);
>
> - for (i = 0; i < upp->sargc; i++) {
> + for (i = 0; *p != '\0'; i++) {
> int ssize, disp, len;
> char *reg = NULL;
> int64_t val = 0;
> @@ -1433,6 +1433,7 @@ static void copy_args(dt_pcb_t *pcb, const dt_uprobe_t *upp)
> usdt_error(pcb, "Unknown format in arg%d spec", i);
> #endif
> }
> + upp->sargc = i;
> }
>
> /*
> @@ -1453,7 +1454,7 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
> dtrace_hdl_t *dtp = pcb->pcb_hdl;
> dt_irlist_t *dlp = &pcb->pcb_ir;
> const dt_probe_t *uprp = pcb->pcb_probe;
> - const dt_uprobe_t *upp = uprp->prv_data;
> + dt_uprobe_t *upp = uprp->prv_data;
> const list_probe_t *pop;
> uint_t lbl_exit = pcb->pcb_exitlbl;
> dt_ident_t *usdt_prids = dt_dlib_get_map(dtp, "usdt_prids");
> @@ -1527,7 +1528,7 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
> if (upp->flags & PP_IS_RETURN)
> goto out;
>
> - if (upp->sargc)
> + if (upp->sargv)
> copy_args(pcb, upp);
> else
> dt_cg_tramp_copy_args_from_regs(pcb, 0);
> --
> 2.43.5
>
next prev parent reply other threads:[~2025-08-05 15:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 9:01 [PATCH v7 0/7] add support for stapsdt probes Alan Maguire
2025-07-30 9:01 ` [PATCH v7 1/7] usdt: have copy_args() count args while parsing them Alan Maguire
2025-08-05 15:04 ` Kris Van Hees [this message]
2025-07-30 9:01 ` [PATCH v7 2/7] support stapsdt ELF-note-defined static probes Alan Maguire
2025-08-05 18:49 ` [DTrace-devel] " Kris Van Hees
2025-08-05 19:05 ` Kris Van Hees
2025-07-30 9:01 ` [PATCH v7 3/7] selftests/usdt: add test for stapsdt note-defined probe firing, args Alan Maguire
2025-07-30 9:01 ` [PATCH v7 4/7] selftests/usdt: add test for stapsdt notes in shared library Alan Maguire
2025-07-30 9:01 ` [PATCH v7 5/7] selftests/usdt: add test covering different forms of stapsdt note args Alan Maguire
2025-07-30 9:01 ` [PATCH v7 6/7] selftests/usdt: add test for stapsdt note-defined probe firing in -fPIE binary Alan Maguire
2025-07-30 9:01 ` [PATCH v7 7/7] selftests/usdt: add is-enabled stapsdt tests using semaphores Alan Maguire
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=aJIdYmQRtsyB0cEj@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=alan.maguire@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/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.