freebsd-dev/sys/cddl/dev
Mark Johnston f263e440d4 SDT probes can directly pass up to five arguments as arguments to
dtrace_probe(). Arguments beyond these five must be obtained in an
architecture-specific way; this can be done through the getargval provider
method, and through dtrace_getarg() if getargval isn't overridden.

This change fixes two off-by-one bugs in the way these arguments are fetched
in FreeBSD's DTrace implementation. First, the SDT provider must set the
aframes parameter to 1 when creating a probe. The aframes parameter controls
the number of frames that dtrace_getarg() will step over in order to find
the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is
called in SDT probe context via

dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg()

so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it
was previously being called with a value of 2 instead. illumos uses a
different aframes value for SDT probes, but this is because illumos SDT
probes fire by triggering the #UD fault handler rather than calling
dtrace_probe() directly.

The second bug has to do with the way arguments are grabbed out
dtrace_probe()'s frame on amd64. The code currently jumps over the first
stack argument and retrieves the rest of them using a pointer into the
stack. This works on i386 because all of dtrace_probe()'s arguments will be
on the stack and the first argument is the probe ID, which should be
ignored. However, it is incorrect to ignore the first stack argument on
amd64, so we correct the pointer used to access the arguments.

MFC after:	2 weeks
2013-06-02 01:05:36 +00:00
..
cyclic Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
dtmalloc
dtrace SDT probes can directly pass up to five arguments as arguments to 2013-06-02 01:05:36 +00:00
fbt fbt_getargdesc: correctly handle types for return probes 2013-03-23 08:52:50 +00:00
lockstat Implement DTrace for PowerPC. This includes both 32-bit and 64-bit. 2012-11-07 23:45:09 +00:00
profile Implement DTrace for PowerPC. This includes both 32-bit and 64-bit. 2012-11-07 23:45:09 +00:00
sdt SDT probes can directly pass up to five arguments as arguments to 2013-06-02 01:05:36 +00:00
systrace Correct the types of the arguments to return probes of the syscall 2011-11-11 03:49:42 +00:00
prototype.c