* [PATCH] usdt; perform __ to - conversion for usdt and prov notes
@ 2025-10-11 3:35 Kris Van Hees
2025-10-11 3:47 ` Kris Van Hees
0 siblings, 1 reply; 2+ messages in thread
From: Kris Van Hees @ 2025-10-11 3:35 UTC (permalink / raw)
To: dtrace, dtrace-devel
The __ to - conversion was only done for usdt notes. It needs to be
done for both usdt and prov notes because they both contain probe
names that may need converting.
Reported-by: Ruud van der Pas <ruud.vanderpas@oracle.com>
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
libcommon/usdt_parser_notes.c | 40 +++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
index c98c9fb0..a8b46e65 100644
--- a/libcommon/usdt_parser_notes.c
+++ b/libcommon/usdt_parser_notes.c
@@ -293,6 +293,27 @@ strarray_size(uint8_t cnt, const char *str, const char *end, size_t skip)
return p - str;
}
+/*
+ * If the probe name has encoded hyphens, perform in-place changing from "__"
+ * into "-".
+ */
+static void
+fix_probe_name(const char *prb, const char *end)
+{
+ if (strstr(prb, "__") != NULL) {
+ char *q;
+ const char *s = prb;
+
+ for (q = (char *)s; s < end; s++, q++) {
+ if (s[0] == '_' && s[1] == '_') {
+ *q = '-';
+ s++;
+ } else if (s > q)
+ *q = *s;
+ }
+ }
+}
+
static int
parse_prov_note(int out, dof_helper_t *dhp, usdt_data_t *data,
usdt_note_t *note)
@@ -353,6 +374,8 @@ parse_prov_note(int out, dof_helper_t *dhp, usdt_data_t *data,
return -1;
}
+ fix_probe_name(prbt.prb, p);
+
if ((prp = dt_htab_lookup(pvp->pmap, &prbt)) == NULL) {
if ((prp = malloc(sizeof(dt_probe_t))) == NULL) {
usdt_error(out, ENOMEM, "Failed to allocate probe");
@@ -471,22 +494,7 @@ parse_usdt_note(int out, dof_helper_t *dhp, usdt_data_t *data,
}
prbt.off = off;
- /*
- * If the probe name has encoded hyphens, perform in-place changing
- * from "__" into "-".
- */
- if (strstr(prbt.prb, "__") != NULL) {
- char *q;
- const char *s = prbt.prb, *e = p;
-
- for (q = (char *)s; s < e; s++, q++) {
- if (s[0] == '_' && s[1] == '_') {
- *q = '-';
- s++;
- } else if (s > q)
- *q = *s;
- }
- }
+ fix_probe_name(prbt.prb, p);
if ((prp = dt_htab_lookup(prbmap, &prbt)) == NULL) {
if ((prp = malloc(sizeof(dt_probe_t))) == NULL) {
--
2.43.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] usdt; perform __ to - conversion for usdt and prov notes
2025-10-11 3:35 [PATCH] usdt; perform __ to - conversion for usdt and prov notes Kris Van Hees
@ 2025-10-11 3:47 ` Kris Van Hees
0 siblings, 0 replies; 2+ messages in thread
From: Kris Van Hees @ 2025-10-11 3:47 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
Nevermind - patch withdrawn
On Fri, Oct 10, 2025 at 11:35:30PM -0400, Kris Van Hees wrote:
> The __ to - conversion was only done for usdt notes. It needs to be
> done for both usdt and prov notes because they both contain probe
> names that may need converting.
>
> Reported-by: Ruud van der Pas <ruud.vanderpas@oracle.com>
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> libcommon/usdt_parser_notes.c | 40 +++++++++++++++++++++--------------
> 1 file changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
> index c98c9fb0..a8b46e65 100644
> --- a/libcommon/usdt_parser_notes.c
> +++ b/libcommon/usdt_parser_notes.c
> @@ -293,6 +293,27 @@ strarray_size(uint8_t cnt, const char *str, const char *end, size_t skip)
> return p - str;
> }
>
> +/*
> + * If the probe name has encoded hyphens, perform in-place changing from "__"
> + * into "-".
> + */
> +static void
> +fix_probe_name(const char *prb, const char *end)
> +{
> + if (strstr(prb, "__") != NULL) {
> + char *q;
> + const char *s = prb;
> +
> + for (q = (char *)s; s < end; s++, q++) {
> + if (s[0] == '_' && s[1] == '_') {
> + *q = '-';
> + s++;
> + } else if (s > q)
> + *q = *s;
> + }
> + }
> +}
> +
> static int
> parse_prov_note(int out, dof_helper_t *dhp, usdt_data_t *data,
> usdt_note_t *note)
> @@ -353,6 +374,8 @@ parse_prov_note(int out, dof_helper_t *dhp, usdt_data_t *data,
> return -1;
> }
>
> + fix_probe_name(prbt.prb, p);
> +
> if ((prp = dt_htab_lookup(pvp->pmap, &prbt)) == NULL) {
> if ((prp = malloc(sizeof(dt_probe_t))) == NULL) {
> usdt_error(out, ENOMEM, "Failed to allocate probe");
> @@ -471,22 +494,7 @@ parse_usdt_note(int out, dof_helper_t *dhp, usdt_data_t *data,
> }
> prbt.off = off;
>
> - /*
> - * If the probe name has encoded hyphens, perform in-place changing
> - * from "__" into "-".
> - */
> - if (strstr(prbt.prb, "__") != NULL) {
> - char *q;
> - const char *s = prbt.prb, *e = p;
> -
> - for (q = (char *)s; s < e; s++, q++) {
> - if (s[0] == '_' && s[1] == '_') {
> - *q = '-';
> - s++;
> - } else if (s > q)
> - *q = *s;
> - }
> - }
> + fix_probe_name(prbt.prb, p);
>
> if ((prp = dt_htab_lookup(prbmap, &prbt)) == NULL) {
> if ((prp = malloc(sizeof(dt_probe_t))) == NULL) {
> --
> 2.43.5
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-11 3:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-11 3:35 [PATCH] usdt; perform __ to - conversion for usdt and prov notes Kris Van Hees
2025-10-11 3:47 ` Kris Van Hees
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox