opnsense-src/sys/modules/dtrace
Christos Margiolis f0bc4ed144 kinst: Initial revision
This is a new DTrace provider which allows arbitrary kernel instructions
to be traced.  Currently it is implemented only for amd64.

kinst probes are created on demand by libdtrace, and there is a probe
for each kernel instruction.  Probes are named
kinst:<module>:<function>:<offset>, where "offset" is the offset of the
target instruction relative to the beginning of the function.  Omitting
"offset" causes all instructions in the function to be traced.

kinst works similarly to FBT in that it places a breakpoint on the
target instruction and hooks into the kernel breakpoint handler.
Because kinst has to be able to trace arbitrary instructions, it does
not emulate most of them in software but rather causes the traced thread
to execute a copy of the instruction before returning to the original
code.

The provider is quite low-level and as-is will be useful mostly only to
kernel developers.  However, it provides a great deal of visibility into
kernel code execution and could be used as a building block for
higher-level tooling which can in some sense translate between C sources
and generated machine code.  In particular, the "regs" variable recently
added to D allows the CPU's register file to be accessed from kinst
probes.

kinst is experimental and should not be used on production systems for
now.

In collaboration with:	markj
Sponsored by:		Google, Inc. (GSoC 2022)
MFC after:		3 months
Differential Revision:	https://reviews.freebsd.org/D36851
2022-10-11 18:19:08 -04:00
..
dtaudit openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
dtmalloc openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
dtnfscl openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
dtrace Export symbols from opensolaris.ko and dtrace.ko 2021-11-17 13:51:10 -05:00
dtrace_test Don't redefine _KERNEL. 2017-11-24 19:08:54 +00:00
dtraceall Move most of the contents of opt_compat.h to opt_global.h. 2018-04-06 17:35:35 +00:00
fasttrap openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
fbt openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
kinst kinst: Initial revision 2022-10-11 18:19:08 -04:00
profile openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
prototype openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
sdt openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
systrace openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
systrace_freebsd32 openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
systrace_linux openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
systrace_linux32 openzfs: fix gcc kernel module builds 2020-12-27 14:33:13 -08:00
Makefile kinst: Initial revision 2022-10-11 18:19:08 -04:00
Makefile.inc Implement the lockstat provider using SDT(9) instead of the custom provider 2015-07-19 22:14:09 +00:00