[DTrace-devel] [PATCH v2 01/15] parser: ensure 'args' is not marked DPTR

Kris Van Hees kris.van.hees at oracle.com
Thu Feb 23 15:30:11 UTC 2023


Since args[] is not actually an array it should not be marked DPTR.
It is not a pointer at all to any memory but rather a syntactic
construct to be able to reference (possibly translated) typed probe
arguments.  It can only be used as an indexed expression (args[idx])
and is rendered in code as either a builtin variable (arg0 .. arg9)
lookup or as a dynamic expression.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_parser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libdtrace/dt_parser.c b/libdtrace/dt_parser.c
index e4d6a062..ea9ff15b 100644
--- a/libdtrace/dt_parser.c
+++ b/libdtrace/dt_parser.c
@@ -2838,11 +2838,12 @@ dt_xcook_ident(dt_node_t *dnp, dt_idhash_t *dhp, uint_t idkind, int create)
 		 * REF-type, we mark this variable node as a pointer to
 		 * DTrace-managed storage (DPTR).
 		 *
-		 * We account for one notable exception: execname.
+		 * We account for two notable exception: args and execname.
 		 */
 		if (idp->di_flags & DT_IDFLG_DPTR)
 			dnp->dn_flags |= DT_NF_DPTR;
 		else if ((dnp->dn_flags & DT_NF_REF) &&
+			 idp->di_id != DIF_VAR_ARGS &&
 			 idp->di_id != DIF_VAR_EXECNAME)
 			dnp->dn_flags |= DT_NF_DPTR;
 
-- 
2.39.1




More information about the DTrace-devel mailing list