ktracer.1m (2010 09)
k
ktracer(1M) ktracer(1M)
To obtain the hexadecimal addresses for each kernel function name, use the following com-
mand:
# /bin/nm -p -v -x /stand/vmunix
To obtain the decimal addresses for each kernel function name, use the following command:
# /bin/nm -p -v /stand/vmunix
If several local or static functions have the same name, specifying them by address provides a
way to distinguish them. The following example shows how to trace both of the functions
named "rand".
# nm -pxv vmunix | egrep -w rand
0xe000000001d8fbe0 t rand
0xe000000001dcb660 t rand
# ktracer -a 0xe000000001d8fbe0 -a 0xe000000001dcb660
-e [modname:]func_pattern
Add all the kernel functions that match a specified pattern to the list of functions to trace.
The func_pattern argument is required, and is an extended regular expression as used by
egrep. See regexp (5) and egrep (1). All functions matching the expression will be added.
As with the
-m option, modname specifies the name of a kernel module, and it may contain file
name expansion characters as used by the shell (see sh(1)). modname supplies the name space
to search within for kernel functions. The modname argument is optional, and if not specified,
the name space searched is the booted vmunix file.
-e func_pattern will search the vmunix name space for functions that match the specified
func_pattern , and add them to the list of functions to trace.
The following regular expression pattern matching example will add to the traced function list
all the kernel functions whose names start with
vx_ plus all whose names end with wait
.
# ktracer -e "ˆvx_" -e "wait$"
The regexp rw.*lock could match rwlock, rwunlock, and any function name containing
rw followed by 0 or more of any character, followed by lock.
The set of valid kernel function names varies and is subject to change without notice.
# ktracer -e modname:func_pattern
will search the name space of the modules matching modname for functions matching the
specified func_pattern. ktracer will add all functions that match as functions to be traced,
excepting untraceable ones.
-l library
Trace functions in the specified library or object file.
Add all the functions that are defined in the specified kernel library (
.a) or object file (.o)to
the list of functions to trace. The library argument can be a path name, or the base name of a
library in /usr/conf/lib. Multiple -l options are accepted. For example:
# ktracer -l libnfs.a -l libsync.a -l file.o -B
-m modname
Trace functions in the specified module name or object file.
All the functions that are defined in the named kernel module are added to the list of functions
to trace. The modname argument can be a path name, or the basename of a module in
/usr/conf/mod. ktracer treats the module argument as a pattern for file name expan-
sion, just as the shell would. The following example will trace the functions from all kernel
modules with module names that start with pm_ or vm_.
# ktracer -m [pv]m_* -B
To see which modules match the pattern, invoke
# ls /usr/conf/mod/[pv]m_*
Multiple -m options are accepted. This next example will trace the functions in the iexgbe
module, plus the functions in all modules whose name starts with nfs, whether that is NFS
6 Hewlett-Packard Company − 6 − HP-UX 11i Version 3: September 2010