Changeset View
Changeset View
Standalone View
Standalone View
share/man/man4/dtrace_kinst.4
Show All 30 Lines | |||||
.Nm dtrace_kinst | .Nm dtrace_kinst | ||||
.Nd a DTrace provider for tracing arbitrary instructions in a given kernel function | .Nd a DTrace provider for tracing arbitrary instructions in a given kernel function | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
kinst::<function>:<instruction> | kinst::<function>:<instruction> | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The DTrace | The DTrace | ||||
.Nm kinst | .Nm kinst | ||||
provider allows the user to trace any instruction in a given kernel function. | provider allows the user to trace any instruction in a given kernel function. | ||||
<function> corresponds to the function to be traced, and <instruction> is the | .Cm <function> | ||||
offset to the specific instruction, and can be obtained from the function's | corresponds to the function to be traced, and | ||||
disassembly using kgdb from the gdb package. | .Cm <instruction> | ||||
is the offset to the specific instruction, and can be obtained from the | |||||
function's disassembly using kgdb from the gdb package. | |||||
.Pp | .Pp | ||||
.Nm kinst | .Nm kinst | ||||
can also trace inline functions by requesting a probe of the form | |||||
.Cm kinst::<inline_func>:<entry/return> . | |||||
If the probe is | |||||
.Cm entry | |||||
or | |||||
.Cm return | |||||
but the function is not an inline one, the probe will be delegated to FBT, | |||||
otherwise DTrace will find all call sites of the inline function and create | |||||
individual probes for each one of them. | |||||
.Pp | |||||
.Nm kinst | |||||
creates probes on-demand, meaning it searches for and parses the function's | creates probes on-demand, meaning it searches for and parses the function's | ||||
instructions each time | instructions each time | ||||
.Xr dtrace 1 | .Xr dtrace 1 | ||||
is run, and not at module load time. | is run, and not at module load time. | ||||
This is in contrast to FBT's load-time parsing, since | This is in contrast to FBT's load-time parsing, since | ||||
.Nm kinst | .Nm kinst | ||||
can potentially create thousands of probes for just a single function, instead | can potentially create thousands of probes for just a single function, instead | ||||
of up to two (entry and return) in the case of FBT. | of up to two (entry and return) in the case of FBT. | ||||
Show All 15 Lines | Dump of assembler code for function vm_fault: | ||||
0xffffffff80876df4 <+4>: 41 57 push %r15 | 0xffffffff80876df4 <+4>: 41 57 push %r15 | ||||
# dtrace -n 'kinst::vm_fault:4 {printf("%#x", regs[R_RSI]);}' | # dtrace -n 'kinst::vm_fault:4 {printf("%#x", regs[R_RSI]);}' | ||||
2 81500 vm_fault:4 0x827c56000 | 2 81500 vm_fault:4 0x827c56000 | ||||
2 81500 vm_fault:4 0x827878000 | 2 81500 vm_fault:4 0x827878000 | ||||
2 81500 vm_fault:4 0x1fab9bef0000 | 2 81500 vm_fault:4 0x1fab9bef0000 | ||||
2 81500 vm_fault:4 0xe16cf749000 | 2 81500 vm_fault:4 0xe16cf749000 | ||||
0 81500 vm_fault:4 0x13587c366000 | 0 81500 vm_fault:4 0x13587c366000 | ||||
... | ^C | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Trace all instructions in | Trace all instructions in | ||||
.Fn amd64_syscall : | .Fn amd64_syscall : | ||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
# dtrace -n 'kinst::amd64_syscall:' | # dtrace -n 'kinst::amd64_syscall:' | ||||
dtrace: description 'kinst::amd64_syscall:' matched 458 probes | |||||
CPU ID FUNCTION:NAME | |||||
2 80676 amd64_syscall:323 | |||||
2 80677 amd64_syscall:326 | |||||
2 80678 amd64_syscall:334 | |||||
2 80679 amd64_syscall:339 | |||||
2 80680 amd64_syscall:345 | |||||
2 80681 amd64_syscall:353 | |||||
^C | |||||
.Ed | |||||
.Pp | |||||
Trace the return point of | |||||
.Fn vm_page_mvqueue , | |||||
which is an inline function: | |||||
.Bd -literal -offset indent | |||||
# dtrace -n 'kinst::vm_page_mvqueue:return' | |||||
dtrace: description 'kinst::vm_page_mvqueue:return' matched 15 probes | |||||
CPU ID FUNCTION:NAME | |||||
2 80627 vm_page_advise:421 | |||||
2 80627 vm_page_advise:421 | |||||
2 80627 vm_page_advise:421 | |||||
2 80618 vm_page_deactivate:85 | |||||
1 80618 vm_page_deactivate:85 | |||||
2 80618 vm_page_deactivate:85 | |||||
1 80618 vm_page_deactivate:85 | |||||
^C | |||||
.Ed | .Ed | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr dtrace 1 | .Xr dtrace 1 | ||||
.Sh HISTORY | .Sh HISTORY | ||||
The | The | ||||
.Nm kinst | .Nm kinst | ||||
provider first appeared in | provider first appeared in | ||||
.Fx | .Fx | ||||
14.0. | 14.0. | ||||
.Sh AUTHORS | .Sh AUTHORS | ||||
This manual page was written by | This manual page was written by | ||||
.An Christos Margiolis Aq Mt christos@FreeBSD.org . | .An Christos Margiolis Aq Mt christos@FreeBSD.org . |