[DTrace-devel] [PATCH 3/3] Implement argument retrieval for SDT probes
Eugene Loh
eugene.loh at oracle.com
Fri Jul 2 11:59:37 PDT 2021
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
Thanks for your earlier note on testing but this patch really seems to
need something, as hard as that something is to come up with.
And...
On 7/2/21 2:19 PM, Kris Van Hees wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> libdtrace/dt_prov_sdt.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/libdtrace/dt_prov_sdt.c b/libdtrace/dt_prov_sdt.c
> index 712f533f..b4d6189b 100644
> --- a/libdtrace/dt_prov_sdt.c
> +++ b/libdtrace/dt_prov_sdt.c
> @@ -126,8 +126,6 @@ static int populate(dtrace_hdl_t *dtp)
> * The trampoline will populate a dt_dctx_t struct and then call the function
> * that implements the compiled D clause. It returns the value that it gets
> * back from that function.
> - *
> - * FIXME: Currently, access to arguments of the tracepoint is not supported.
> */
> static void trampoline(dt_pcb_t *pcb)
> {
> @@ -145,12 +143,16 @@ static void trampoline(dt_pcb_t *pcb)
> dt_cg_tramp_clear_regs(pcb);
>
> /*
> - * for (i = 0; i < ARRAY_SIZE(((dt_mstate_t *)0)->argv); i++)
> - * dctx->mst->argv[i] = 0
> - * // stdw [%r7 + DMST_ARG(i)], 0
> + * for (i = 0; i < argc; i++)
> + * dctx->mst->argv[i] = ((uint64_t *)ctx)[i + 1];
> + * // (first value is private)
> + * // lddw %r0, [%r8 + (i + 1) * 8]
> + * // stdw [%r7 + DMST_ARG(i)], 0
No big deal, but I thought you preferred tabs over spaces for alignment.
Also, update comment to stdw r0 rather than 0.
> */
> - for (i = 0; i < pcb->pcb_pinfo.dtp_argc; i++)
> - emit(dlp, BPF_STORE_IMM(BPF_DW, BPF_REG_7, DMST_ARG(i), 0));
> + for (i = 0; i < pcb->pcb_pinfo.dtp_argc; i++) {
> + emit(dlp, BPF_LOAD(BPF_DW, BPF_REG_0, BPF_REG_8, (i + 1) * 8));
> + emit(dlp, BPF_STORE(BPF_DW, BPF_REG_7, DMST_ARG(i), BPF_REG_0));
> + }
>
> dt_cg_tramp_epilogue(pcb);
> }
More information about the DTrace-devel
mailing list