Jesse Butler
2006-Sep-11 15:47 UTC
[Fwd: [dtrace-discuss] SDT probes used for error tracing]
Rather than the previous generic how-to question, I have an idea of something that might work. Maybe someone could tell me if I''m on the right track? I''d like to replace the tracing facility in a debug module with SDT probes, so that the debug tracing can simply be enabled in place. Specifically, I''d like to trace failures in functions, and also report when a bad argument is sent in. Can I simply do this by naming the probes according to the function and failure? So, something like this: function1() { int ret; if ((ret = initialize()) == FAILED) { drv_trace("function1: initialize failed"); goto fail1; } if ((ret = configure()) == FAILED) { drv_trace("function1: configure failed"); goto fail2; } etc... Could be something like this: function1() { int ret; if ((ret = initialize()) == FAILED) { DTRACE_PROBE(function1__initialize__failed); goto fail1; } if ((ret = configure()) == FAILED) { DTRACE_PROBE(function1__configure__failed); goto fail2; } etc... It seems I might end up with a *lot* of probes, but maybe that''s OK? Thanks, Jesse -------- Original Message -------- Subject: [dtrace-discuss] SDT probes used for error tracing Date: Fri, 08 Sep 2006 12:01:46 -0400 From: Jesse Butler <Jesse.Butler at Sun.COM> Reply-To: Jesse.Butler at Sun.COM Organization: Sun Microsystems To: dtrace-discuss at opensolaris.org Is there a suggested way (or is it even possible) to pass a string to a DTRACE_PROBE function, like could be done with TNF_PROBE functions? I am interested in using Dtrace to dump error conditions whilst debugging. Thanks, Jesse _______________________________________________ dtrace-discuss mailing list dtrace-discuss at opensolaris.org
James Dickens
2006-Sep-11 22:33 UTC
[Fwd: [dtrace-discuss] SDT probes used for error tracing]
On 9/11/06, Jesse Butler <Jesse.Butler at sun.com> wrote:> Rather than the previous generic how-to question, I have an idea of something > that might work. Maybe someone could tell me if I''m on the right track? > > I''d like to replace the tracing facility in a debug module with SDT probes, so > that the debug tracing can simply be enabled in place. Specifically, I''d like > to trace failures in functions, and also report when a bad argument is sent in. > > Can I simply do this by naming the probes according to the function and failure? > > So, something like this: > > function1() > { > int ret; > > if ((ret = initialize()) == FAILED) { > drv_trace("function1: initialize failed"); > goto fail1; > } > > if ((ret = configure()) == FAILED) { > drv_trace("function1: configure failed"); > goto fail2; > } > > etc... > > Could be something like this: > > function1() > { > int ret; > > if ((ret = initialize()) == FAILED) { > DTRACE_PROBE(function1__initialize__failed); > goto fail1; > } > > if ((ret = configure()) == FAILED) { > DTRACE_PROBE(function1__configure__failed); > goto fail2; > } >while you could do as you propose, but I don''t really see the point, since if either of these events fail, you would most likely log the event or possibly even exit with an error message. So you would be probing events that are already known and most likely these aren''t common events anyway, there isn''t much point. DTrace probes are more effective when you probe common things, successful completion of work that you some times want to monitor, at least while testing or performance tuning. James Dickens uadmin.blogspot.com> etc... > > It seems I might end up with a *lot* of probes, but maybe that''s OK? > > Thanks, > Jesse > > > > -------- Original Message -------- > Subject: [dtrace-discuss] SDT probes used for error tracing > Date: Fri, 08 Sep 2006 12:01:46 -0400 > From: Jesse Butler <Jesse.Butler at Sun.COM> > Reply-To: Jesse.Butler at Sun.COM > Organization: Sun Microsystems > To: dtrace-discuss at opensolaris.org > > Is there a suggested way (or is it even possible) to pass a string to a > DTRACE_PROBE function, like could be done with TNF_PROBE functions? I am > interested in using Dtrace to dump error conditions whilst debugging. > > Thanks, > Jesse > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
Adam Leventhal
2006-Sep-11 22:46 UTC
[Fwd: [dtrace-discuss] SDT probes used for error tracing]
Hi Jesse, You could certainly do that, and there would be no problem having a bunch of probes. I wonder if you might want to put the probe in the initialize() function itself rather than trusting the callers to fire the probe. Even simpler: you could use the pid provider to see if the function failed: pid123::initialize:return /arg1 == FAILED/ { trace("initialize() failed"); ustack(); } Adam On Mon, Sep 11, 2006 at 11:47:21AM -0400, Jesse Butler wrote:> Rather than the previous generic how-to question, I have an idea of > something that might work. Maybe someone could tell me if I''m on the right > track? > > I''d like to replace the tracing facility in a debug module with SDT probes, > so that the debug tracing can simply be enabled in place. Specifically, > I''d like to trace failures in functions, and also report when a bad > argument is sent in. > > Can I simply do this by naming the probes according to the function and > failure? > > So, something like this: > > function1() > { > int ret; > > if ((ret = initialize()) == FAILED) { > drv_trace("function1: initialize failed"); > goto fail1; > } > > if ((ret = configure()) == FAILED) { > drv_trace("function1: configure failed"); > goto fail2; > } > > etc... > > Could be something like this: > > function1() > { > int ret; > > if ((ret = initialize()) == FAILED) { > DTRACE_PROBE(function1__initialize__failed); > goto fail1; > } > > if ((ret = configure()) == FAILED) { > DTRACE_PROBE(function1__configure__failed); > goto fail2; > } > > etc... > > It seems I might end up with a *lot* of probes, but maybe that''s OK? > > Thanks, > Jesse > > > > -------- Original Message -------- > Subject: [dtrace-discuss] SDT probes used for error tracing > Date: Fri, 08 Sep 2006 12:01:46 -0400 > From: Jesse Butler <Jesse.Butler at Sun.COM> > Reply-To: Jesse.Butler at Sun.COM > Organization: Sun Microsystems > To: dtrace-discuss at opensolaris.org > > Is there a suggested way (or is it even possible) to pass a string to a > DTRACE_PROBE function, like could be done with TNF_PROBE functions? I am > interested in using Dtrace to dump error conditions whilst debugging. > > Thanks, > Jesse > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl