[DTrace-devel] [PATCH 04/14] Track uprobe provider descriptions

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Jun 4 18:11:03 UTC 2024


From: Eugene Loh <eugene.loh at oracle.com>

A uprobe will have to decide which of its clauses to run for a
given pid.  For now, keep the provider description for each clause.
There are many shortcomings to the way this is done in this patch,
but it is quick and dirty and helps us bootstrap real support.
Clean this up later, probably turning it into a growable array.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 libdtrace/dt_cc.c   | 1 +
 libdtrace/dt_impl.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
index d1ee3843..6bff7e0f 100644
--- a/libdtrace/dt_cc.c
+++ b/libdtrace/dt_cc.c
@@ -215,6 +215,7 @@ dt_compile_one_clause(dtrace_hdl_t *dtp, dt_node_t *cnp, dt_node_t *pnp)
 	 */
 	dt_cg(yypcb, cnp);
 	sdp->dtsd_clause = dt_clause_create(dtp, dt_as(yypcb));
+	dtp->dt_uprovdescs[dtp->dt_clause_nextid - 1] = strdup(pnp->dn_desc->prv);
 
 	assert(yypcb->pcb_stmt == sdp);
 	if (dtrace_stmt_add(yypcb->pcb_hdl, yypcb->pcb_prog, sdp) != 0)
diff --git a/libdtrace/dt_impl.h b/libdtrace/dt_impl.h
index 01313ff3..1bf79d80 100644
--- a/libdtrace/dt_impl.h
+++ b/libdtrace/dt_impl.h
@@ -310,6 +310,7 @@ struct dtrace_hdl {
 	dt_pcb_t *dt_pcb;	/* pointer to current parsing control block */
 	ulong_t dt_gen;		/* compiler generation number */
 	uint_t dt_clause_nextid; /* next ID to use for programs */
+	char *dt_uprovdescs[256]; /* uprobe provider descriptor per clause... FIXME turn this into a growable array */
 	dt_list_t dt_programs;	/* linked list of dtrace_prog_t's */
 	dt_list_t dt_xlators;	/* linked list of dt_xlator_t's */
 	dt_list_t dt_enablings;	/* list of (to be) enabled probes */
-- 
2.18.4




More information about the DTrace-devel mailing list