From: Alan Maguire <alan.maguire@oracle.com>
To: dtrace@lists.linux.dev
Cc: dtrace-devel@oss.oracle.com, Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH v5 1/6] usdt: have copy_args() count args while parsing them
Date: Thu, 10 Jul 2025 22:59:25 +0100 [thread overview]
Message-ID: <20250710215930.82067-2-alan.maguire@oracle.com> (raw)
In-Reply-To: <20250710215930.82067-1-alan.maguire@oracle.com>
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 cf5cfd43..2cbd8910 100644
--- a/libdtrace/dt_prov_uprobe.c
+++ b/libdtrace/dt_prov_uprobe.c
@@ -1145,9 +1145,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;
@@ -1158,7 +1158,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; strlen(p) > 0; i++) {
int ssize, disp, len;
char *reg = NULL;
int64_t val = 0;
@@ -1425,6 +1425,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;
}
/*
@@ -1445,7 +1446,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");
@@ -1519,7 +1520,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-07-10 21:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 21:59 [PATCH v5 0/6] add support for stapsdt probes Alan Maguire
2025-07-10 21:59 ` Alan Maguire [this message]
2025-07-25 15:57 ` [PATCH v5 1/6] usdt: have copy_args() count args while parsing them Kris Van Hees
2025-07-10 21:59 ` [PATCH v5 2/6] support stapsdt ELF-note-defined static probes Alan Maguire
2025-07-26 4:04 ` Kris Van Hees
2025-07-10 21:59 ` [PATCH v5 3/6] selftests/usdt: add test for stapsdt note-defined probe firing, args Alan Maguire
2025-07-10 21:59 ` [PATCH v5 4/6] selftests/usdt: add test for stapsdt notes in shared library Alan Maguire
2025-07-10 21:59 ` [PATCH v5 5/6] selftests/usdt: add test covering different forms of stapsdt note args Alan Maguire
2025-07-10 21:59 ` [PATCH v5 6/6] selftests/usdt: add test for stapsdt note-defined probe firing in -fPIE binary 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=20250710215930.82067-2-alan.maguire@oracle.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox