[DTrace-devel] [PATCH 2/3] usdt parser: handle encoded hyphens
Kris Van Hees
kris.van.hees at oracle.com
Tue Jun 24 21:40:25 UTC 2025
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
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;
+ }
+ }
+
if ((prp = dt_htab_lookup(prbmap, &prbt)) == NULL) {
if ((prp = malloc(sizeof(dt_probe_t))) == NULL) {
usdt_error(out, ENOMEM, "Failed to allocate probe");
--
2.43.5
More information about the DTrace-devel
mailing list