[DTrace-devel] [PATCH 4/7] Add support for indexed built-in variables lookup

Eugene Loh eugene.loh at oracle.com
Thu May 26 20:31:29 UTC 2022


This patch breaks disassembly of built-in variables.  How about:

1)  moving this (pretty small) patch into #5/7, or

2)  moving the bvar disassembly fix from #5/7 back into this patch

That is, the break and the fix should be in the same patch.

On 5/26/22 11:24, Kris Van Hees via DTrace-devel wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   bpf/get_bvar.c    | 7 ++++++-
>   libdtrace/dt_cg.c | 1 +
>   2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/bpf/get_bvar.c b/bpf/get_bvar.c
> index 0da4b35a..4ff9b695 100644
> --- a/bpf/get_bvar.c
> +++ b/bpf/get_bvar.c
> @@ -33,7 +33,7 @@ extern uint64_t BOOTTM;
>   		-1; \
>   	})
>   
> -noinline uint64_t dt_get_bvar(const dt_dctx_t *dctx, uint32_t id)
> +noinline uint64_t dt_get_bvar(const dt_dctx_t *dctx, uint32_t id, uint32_t idx)
>   {
>   	dt_mstate_t	*mst = dctx->mst;
>   
> @@ -54,6 +54,11 @@ noinline uint64_t dt_get_bvar(const dt_dctx_t *dctx, uint32_t id)
>   	case DIF_VAR_ARG6: case DIF_VAR_ARG7: case DIF_VAR_ARG8:
>   	case DIF_VAR_ARG9:
>   		return mst->argv[id - DIF_VAR_ARG0];
> +	case DIF_VAR_ARGS:
> +		if (idx >= sizeof(mst->argv) / sizeof(mst->argv[0]))
> +			return error(dctx, DTRACEFLT_ILLOP, 0);
> +
> +		return mst->argv[idx];
>   	case DIF_VAR_STACKDEPTH:
>   	case DIF_VAR_USTACKDEPTH: {
>   		uint32_t bufsiz = (uint32_t) (uint64_t) (&STKSIZ);
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index a08fac89..bbddc986 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -2236,6 +2236,7 @@ dt_cg_load_var(dt_node_t *dst, dt_irlist_t *dlp, dt_regset_t *drp)
>   
>   	emit(dlp, BPF_LOAD(BPF_DW, BPF_REG_1, BPF_REG_FP, DT_STK_DCTX));
>   	emit(dlp, BPF_MOV_IMM(BPF_REG_2, idp->di_id));
> +	emit(dlp, BPF_MOV_IMM(BPF_REG_3, 0));
>   	idp = dt_dlib_get_func(yypcb->pcb_hdl, "dt_get_bvar");
>   	assert(idp != NULL);
>   	dt_regset_xalloc(drp, BPF_REG_0);



More information about the DTrace-devel mailing list