[DTrace-devel] [PATCH 2/3] usdt parser: handle encoded hyphens
Nick Alcock
nick.alcock at oracle.com
Tue Jul 15 14:21:23 UTC 2025
On 24 Jun 2025, Kris Van Hees via DTrace-devel outgrape:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
How did I miss this case? And yes, no probe with embedded hyphens will
work without this (such as foo-entry above): they'll show up, but as
e.g. foo__entry instead.
You could probably make the test fail by explicitly naming one of those
hyphenated probes in the D script: right now, the script just uses
wildcards, which will catch everything whether the de-double-underscore
code kicks in or not.
> ---
> libcommon/usdt_parser_notes.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
> index fb57f119..d3d744fb 100644
> --- a/libcommon/usdt_parser_notes.c
> +++ b/libcommon/usdt_parser_notes.c
> @@ -471,6 +471,23 @@ 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;
> + }
> + }
> +
This seems OK to me. I mean, fairly horrible, but C string handling *is*
fairly horrible. :)
--
NULL && (void)
More information about the DTrace-devel
mailing list