Skip to contentSkip to conversation

dlib: remove obsolete dt_dlib_add_probe_var()

PATCH In review Kris Van Hees 2 participants 2 messages Mar 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dlib: remove obsolete dt_dlib_add_probe_var()

The dt_dlib_add_probe_var() function was added to allow for relcoation processing filling in probe ids for dependent probes, but since the probe ids are known at code generation time, there is no need for this.

---
 libdtrace/dt_cg.c          |  3 +--
 libdtrace/dt_dlibs.c       | 16 ----------------
 libdtrace/dt_prov_uprobe.c |  6 +-----
 3 files changed, 2 insertions(+), 23 deletions(-)
libdtrace/dt_cg.c +1 -2
index 8cc99246..e954173b 100644
@@ -905,14 +905,13 @@ dt_cg_add_dependent(dtrace_hdl_t *dtp, dt_probe_t *prp, void *arg)
 {
 	dt_pcb_t	*pcb = dtp->dt_pcb;
 	dt_irlist_t	*dlp = &pcb->pcb_ir;
-	dt_ident_t	*idp = dt_dlib_add_probe_var(pcb->pcb_hdl, prp);
 	uint_t		exitlbl = dt_irlist_label(dlp);
 	int		skip = 0;
 
 	dt_cg_tramp_save_args(pcb);
 	pcb->pcb_parent_probe = pcb->pcb_probe;
 	pcb->pcb_probe = prp;
-	emite(dlp, BPF_STORE_IMM(BPF_W, BPF_REG_7, DMST_PRID, prp->desc->id), idp);
+	emit(dlp, BPF_STORE_IMM(BPF_W, BPF_REG_7, DMST_PRID, prp->desc->id));
 	if (prp->prov->impl->trampoline != NULL)
 		skip = prp->prov->impl->trampoline(pcb, exitlbl);
 
libdtrace/dt_dlibs.c +0 -16
index 9ad4f5e7..9a2970c7 100644
@@ -250,22 +250,6 @@ dt_dlib_add_var(dtrace_hdl_t *dtp, const char *name, uint_t id)
 	return dt_dlib_add_sym_id(dtp, name, DT_IDENT_SCALAR, id);
 }
 
-/*
- * Add a BPF variable for a probe.
- * The fully qualified probe name is tha variable name, and the probe ID is the
- * value of the variable.
- */
-dt_ident_t *
-dt_dlib_add_probe_var(dtrace_hdl_t *dtp, const dt_probe_t *prp)
-{
-	char	pn[DTRACE_FULLNAMELEN + 1];
-
-	snprintf(pn, DTRACE_FULLNAMELEN, "%s:%s:%s:%s", prp->desc->prv,
-		 prp->desc->mod, prp->desc->fun, prp->desc->prb);
-
-	return dt_dlib_add_var(dtp, pn, prp->desc->id);
-}
-
 /*
  * Return the DIFO for an external symbol.
  */
libdtrace/dt_prov_uprobe.c +1 -5
index 8dbd2aed..28762eb3 100644
@@ -947,7 +947,6 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
 		const dt_probe_t	*prp = pop->probe;
 		uint_t			lbl_next = dt_irlist_label(dlp);
 		pid_t			pid;
-		dt_ident_t		*idp;
 
 		if (prp->prov->impl != &dt_pid)
 			continue;
@@ -955,9 +954,6 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
 		pid = dt_pid_get_pid(prp->desc, pcb->pcb_hdl, pcb, NULL);
 		assert(pid != -1);
 
-		idp = dt_dlib_add_probe_var(pcb->pcb_hdl, prp);
-		assert(idp != NULL);
-
 		/*
 		 * Populate probe arguments.
 		 */
@@ -971,7 +967,7 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
 		 * process, and emit a sequence of clauses for it when it does.
 		 */
 		emit(dlp,  BPF_BRANCH_IMM(BPF_JNE, BPF_REG_6, pid, lbl_next));
-		emite(dlp, BPF_STORE_IMM(BPF_W, BPF_REG_7, DMST_PRID, prp->desc->id), idp);
+		emit(dlp,  BPF_STORE_IMM(BPF_W, BPF_REG_7, DMST_PRID, prp->desc->id));
 		dt_cg_tramp_call_clauses(pcb, prp, DT_ACTIVITY_ACTIVE);
 		emitl(dlp, lbl_next,
 			   BPF_NOP());
Signature · 1 line
2.45.2
Reviewed-by on v1 1/2
#1 lore raw

On 21 Mar 2025, Kris Van Hees via DTrace-devel outgrape:

Quoted 3 lines

The dt_dlib_add_probe_var() function was added to allow for relcoation processing filling in probe ids for dependent probes, but since the probe ids are known at code generation time, there is no need for this.

I guess this is removing a relocation/fixup which was always the identity transformation (prp->desc->id being reset to itself at reloc resolution time).

If so...

Quoted 1 line
Signature · 1 line
NULL && (void)