ktracer.1m (2010 09)

k
ktracer(1M) ktracer(1M)
client or server code or otherwise.
# ktracer -m iexgbe -m nfs* -B
Functions from statically linked modules and functions from dynamically loadable kernel
modules (DLKMs) are traceable.
In the event that a DLKM is unloaded while functions within it are being traced,
ktracer
will stop tracing those functions that get unloaded, while continuing to trace the rest. If that
DLKM is later reloaded, the functions within it will not be traced unless they are added to the
traced function list again, by a command resembling the following.
# ktracer -m module
or
# ktracer -a DLKM_func_1 -a
DLKM_func_2
-r func Remove the specified function from the traced function list.
This option removes the specified function from the set of functions to trace. The effect is that
calls to this function will no longer traced, leaving more room in the trace buffers for other
trace records, and eliminating the performance impact at the call site of the specified function.
The func argument can be a function name or a hexadecimal or decimal address. Removing a
function that is not on the list has no effect.
Multiple
-r options are permitted.
-S func Similar to the -a func option, -S func will add the specified function to the traced function
list. However, unlike the -a func option, -S func will associate a special STOP tracing attri-
bute with the specified function.
Any function possessing the STOP tracing attribute is called a STOP function. Similar to the
-a func option, -S func requires subsequent options to insert a trace point for the specified
function (-I), and to begin tracing (-b) before the STOP function can take effect.
Whenever a trace point for a STOP function is executed while kernel tracing is active, a trace
record is collected (if appropriate), then kernel tracing is transitioned to the state:
OFF; Trace NOT active; Funcs INSTALLED; ALLOCATED;
Trace points remain inserted, and the kernel continues execution. However, the collection of
trace records halts, so that the circular trace buffers contain trace records that lead up to and
include the call to the STOP function of interest.
From this stopped state, to begin tracing the same functions again, use
-b
. If finished tracing
the selected functions, use
-U to uninsert trace points, thereby regaining faster performance.
To remove a STOP function from the traced function list, use the standard means (
-r
func).
The
-z option will remove all functions, including functions with the STOP tracing attribute,
from the traced function list.
ktracer -S panic -B is an example of using a STOP function. If and when the
panic() function is called and after ktracer collects a trace record for the panic() func-
tion call, ktracer stops collecting further traces. In this way, the trace buffers will contain
the last #traces function calls leading up to the panic and will end with the call to the panic.
Subsequent function calls to print console messages and write physical memory to a dump dev-
ice will not overwrite the function calls leading up to the panic, because the STOP function
stopped trace record collection. Note that panic() is a STOP function by default. An
exit() or close() function for a kernel driver is another potentially useful place to employ
a STOP function.
Multiple
-S options are permitted.
-z Remove all functions from the function list.
Installing the Function List
-I Insert a trace point at the entry point of each and every function in the list of kernel functions
to trace. Inserting trace points is known as "installing the function list". When trace points
are inserted, kernel text is modified. All CPUs on a system rely on the same kernel text, so
trace points mandatorily take effect on all CPUs. Note that when the kernel encounters a
trace point, the kernel will vector or branch to tracing code. In that tracing code, there are
HP-UX 11i Version 3: September 2010 7 Hewlett-Packard Company 7