[DTrace-devel] [PATCH 1/2] error: report probe name on failed enabling error

Eugene Loh eugene.loh at oracle.com
Mon Mar 17 19:57:18 UTC 2025


I don't 100% get our error reporting, but
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

A few things...

The various files need updated copyright years.

On 2/24/25 13:43, Kris Van Hees wrote:

I don't know if anyone else sees this, but this is the second patch in a 
few days that has gotten buried in my inbox due to a stale date.  (On 
Friday, I got one dated 1/24.)  Anyhow, I suppose I now know to look for 
such emails.

> diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
> +int
> +dt_attach_error(dtrace_hdl_t *dtp, int rc, ...)
> +{
> +	va_list	ap, apc;
> +	char	*fmt;

If you asprintf(&fmt), do you want a matching free() to prevent a memory 
leak?  (Clearly not a big deal, but...)
and finally...

> diff --git a/libdtrace/dt_error.c b/libdtrace/dt_error.c
> @@ -111,6 +111,8 @@ dtrace_errmsg(dtrace_hdl_t *dtp, int error)
>   
>   	if (error == EDT_COMPILER && dtp != NULL && dtp->dt_errmsg[0] != '\0')
>   		str = dtp->dt_errmsg;
> +	if (error == EDT_ENABLING_ERR && dtp != NULL && dtp->dt_errmsg[0] != '\0')
> +		str = dtp->dt_errmsg;
>   	else if (error == EDT_BPF && dtp != NULL && dtp->dt_errmsg[0] != '\0')
>   		str = dtp->dt_errmsg;
>   	else if (error == EDT_CTF && dtp != NULL && dtp->dt_ctferr != 0)

Should that be "else if"?  Otherwise, if error==EDT_COMPILER, you 
trigger both that clause and the later "else" clause.



More information about the DTrace-devel mailing list