[DTrace-devel] [PATCH 5/7] Introduce a 'raw' error reporting mechanism

Kris Van Hees kris.van.hees at oracle.com
Wed Dec 7 03:19:29 UTC 2022


On Tue, Dec 06, 2022 at 06:05:33PM -0500, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> though I don't really understand the architecture here.

cmd/dtrace.c registers an error handler with libdtrace.  It gets used for
different cases of error reporting, but all existing ones occur during the
consumer loop processing, i.e. processing trace data.  This adds a function
that allows reporting of errors prior to the consumption of trace data.

> On 12/6/22 16:50, Kris Van Hees via DTrace-devel wrote:
> > The error handling mechanism between libdtrace and consumer front-ends
> > (like dtrace) only allowed the reporting of error messages related to
> > probing activity.  There is a need to allow libdtrace API functions
> > the ability to report error conditions to the consumer front-end.
> > Especially errors encountered while enabling probes can benefit from
> > this mechanism to report the issues.
> > 
> > Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> > ---
> >   libdtrace/dt_handle.c | 20 ++++++++++++++++++++
> >   libdtrace/dt_impl.h   |  1 +
> >   2 files changed, 21 insertions(+)
> > 
> > diff --git a/libdtrace/dt_handle.c b/libdtrace/dt_handle.c
> > index 3c8f0287..670b521e 100644
> > --- a/libdtrace/dt_handle.c
> > +++ b/libdtrace/dt_handle.c
> > @@ -209,6 +209,26 @@ no_addr:
> >   	return 0;
> >   }
> > +int
> > +dt_handle_rawerr(dtrace_hdl_t *dtp, const char *errmsg)
> > +{
> > +	dtrace_errdata_t	err;
> > +
> > +	err.dteda_ddesc = NULL;
> > +	err.dteda_pdesc = NULL;
> > +	err.dteda_cpu = -1;
> > +	err.dteda_action = -1;
> > +	err.dteda_offset = -1;
> > +	err.dteda_fault = DTRACEFLT_LIBRARY;
> > +	err.dteda_addr = 0;
> > +	err.dteda_msg = errmsg;
> > +
> > +	if ((*dtp->dt_errhdlr)(&err, dtp->dt_errarg) == DTRACE_HANDLE_ABORT)
> > +		return dt_set_errno(dtp, EDT_ERRABORT);
> > +
> > +	return 0;
> > +}
> > +
> >   int
> >   dt_handle_liberr(dtrace_hdl_t *dtp, const dtrace_probedata_t *data,
> >       const char *faultstr)
> > diff --git a/libdtrace/dt_impl.h b/libdtrace/dt_impl.h
> > index 4b8ce0a6..3e14d69d 100644
> > --- a/libdtrace/dt_impl.h
> > +++ b/libdtrace/dt_impl.h
> > @@ -786,6 +786,7 @@ extern int dt_print_llquantize(dtrace_hdl_t *, FILE *, const void *, size_t,
> >   extern int dt_print_agg(const dtrace_aggdata_t *, void *);
> >   extern int dt_handle(dtrace_hdl_t *, dtrace_probedata_t *);
> > +extern int dt_handle_rawerr(dtrace_hdl_t *, const char *);
> >   extern int dt_handle_liberr(dtrace_hdl_t *,
> >       const dtrace_probedata_t *, const char *);
> >   extern int dt_handle_cpudrop(dtrace_hdl_t *, processorid_t,
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list