[DTrace-devel] [PATCH 04/10] Include PC in fault reporting

Kris Van Hees kris.van.hees at oracle.com
Mon Mar 21 18:08:10 UTC 2022


On Sat, Mar 19, 2022 at 06:13:41PM -0400, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> with
> 
> On 3/18/22 3:04 PM, Kris Van Hees via DTrace-devel wrote:
> > diff --git a/runtest.sh b/runtest.sh
> > @@ -482,7 +482,8 @@ postprocess()
> >       # TODO: may need adjustment or making optional if scripts emit hex
> >       # values which are not continuously variable.
> > -    sed '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*,{ptr},g' < $tmpdir/pp.out > $final
> > +    sed -e '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*,{ptr},g' \
> > +	-e 's,at BPF pc [1-9][0-9]*,at BPF pc NNN,' < $tmpdir/pp.out > $final
> >       return $retval
> >   }
> The comment block is just out of view, but maybe the remark about "hex
> strings" should be adjusted.

I think that the comment is still applicable.  Nick added it back in 2013 so
I rather defer to him to determine if it needs removal or changing.

> > diff --git a/test/unittest/error/tst.fault-location.sh b/test/unittest/error/tst.fault-location.sh
> > @@ -0,0 +1,31 @@
> > +#!/bin/bash
> > +dtrace=$1
> > +
> > +$dtrace $dt_flags -xdisasm=8 -Sn '
> > +BEGIN
> > +{
> > +	a = b = 0;
> > +	trace(a / b);
> > +	exit(0);
> > +}
> > +
> > +ERROR
> > +{
> > +	exit(1);
> > +}
> > +' 2>&1 | \
> > +	awk '/mov  %r3, [0-9]+/ { flt = int($10); next; }
> > +	     /call dt_probe_error/ { loci[int($1)] = flt; next }
> > +	     /divide-by-zero/ && (int($NF) in loci) && loci[int($NF)] == 4 {
> > +		$NF = "NNN";
> > +		print;
> > +	     }'
> > +
> > +exit $?
> The test is good, but for the awk post-processing, how about:
> 
> *)  Say why 4 is interesting.  Maybe a comment that points out that
> DTRACEFLT_DIVZERO = 4?
> 
> *)  And how about replacing the second two clauses with:
>         /call dt_probe_error/ && flt == 4 { loci = int($1) }
>         /divide-by-zero/ && int($NF) == loci) {...}
>     This stores less stuff and makes clearer what interests us.

Good ideas, which I will include along with printing out a bit more output to
help debugging if the test does fail.

Thanks.
> 

Good ideas, which I will include along with printing out a bit more output to
help debugging if the test does fail.

Thanks.



More information about the DTrace-devel mailing list