Skip to content

Commit

Permalink
providers: allow providers with no trampoline
Browse files Browse the repository at this point in the history
Such providers can be enabled just like any other, but generate no code.

Meant for use by providers like pid which have some probes without
trampolines (but which enable other probes which do contain trampolines
that execute on their behalf).  Both such probes need enabling because
we want to ensure their names are interned, etc: we only want to avoid
trying to execute their trampoline when there is none.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock authored and kvanhees committed Oct 27, 2022
1 parent 79a4245 commit 943fb84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libdtrace/dt_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,13 @@ dt_bpf_load_progs(dtrace_hdl_t *dtp, uint_t cflags)
if (prp == dtp->dt_error)
continue;

/*
* Enabled probes with no trampoline act like they exist but
* no code is generated for them.
*/
if (prp->prov->impl->trampoline == NULL)
continue;

dp = dt_program_construct(dtp, prp, cflags, NULL);
if (dp == NULL)
return -1;
Expand Down
3 changes: 2 additions & 1 deletion libdtrace/dt_cg.c
Original file line number Diff line number Diff line change
Expand Up @@ -6899,7 +6899,8 @@ dt_cg(dt_pcb_t *pcb, dt_node_t *dnp)
} else if (dnp->dn_kind == DT_NODE_TRAMPOLINE) {
assert(pcb->pcb_probe != NULL);

pcb->pcb_probe->prov->impl->trampoline(pcb);
if (pcb->pcb_probe->prov->impl->trampoline != NULL)
pcb->pcb_probe->prov->impl->trampoline(pcb);
} else
dt_cg_node(dnp, &pcb->pcb_ir, pcb->pcb_regs);

Expand Down

0 comments on commit 943fb84

Please sign in to comment.