[DTrace-devel] [PATCH] cg: allow non-fatal dt_cg_ctf_offsetof() failures

Eugene Loh eugene.loh at oracle.com
Thu Nov 30 20:01:51 UTC 2023


Sorry.  I don't think this ever hit my inbox.

Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

How about non-fatal if the struct itself cannot be found???

Wed Nov 22 20:57:08 UTC 2023 patch:
> Lookup failures for a struct member should not always be fatal.  There
> is a need to be able to try again (e.g. to support the case where a
> struct member was renamed between two kernel versions).
>
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> @@ -1650,8 +1651,13 @@ dt_cg_ctf_offsetof(const char *structname, 
> const char *membername, size_t *sizep
>   ctfp = sym.dtt_ctfp;
>   if (!ctfp) /* Should never happen. */
>   longjmp(yypcb->pcb_jmpbuf, EDT_NOCTF);
> - if (ctf_member_info(ctfp, sym.dtt_type, membername, &ctm) == CTF_ERR)
> - longjmp(yypcb->pcb_jmpbuf, EDT_NOCTF);
> + if (ctf_member_info(ctfp, sym.dtt_type, membername, &ctm) == CTF_ERR) {
> + if (relaxed)
> + return -1;
> + else

Looks fine, though could also drop the "else".

> + longjmp(yypcb->pcb_jmpbuf, EDT_NOCTF);
> + }
> +
>   if (sizep)
>   *sizep = ctf_type_size(ctfp, ctm.ctm_type);
>



More information about the DTrace-devel mailing list