[BACK]Return to ltrace.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / ktrace

Annotation of src/usr.bin/ktrace/ltrace.1, Revision 1.9

1.9     ! guenther    1: .\"    $OpenBSD: ltrace.1,v 1.8 2015/09/07 18:17:10 jmc Exp $
1.1       miod        2: .\"
                      3: .\" Copyright (c) 2013 Miodrag Vallat.
                      4: .\"
                      5: .\" Permission to use, copy, modify, and distribute this software for any
                      6: .\" purpose with or without fee is hereby granted, provided that the above
                      7: .\" copyright notice and this permission notice appear in all copies.
                      8: .\"
                      9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     16: .\"
                     17: .\" Copyright (c) 1990, 1993
                     18: .\"    The Regents of the University of California.  All rights reserved.
                     19: .\"
                     20: .\" Redistribution and use in source and binary forms, with or without
                     21: .\" modification, are permitted provided that the following conditions
                     22: .\" are met:
                     23: .\" 1. Redistributions of source code must retain the above copyright
                     24: .\"    notice, this list of conditions and the following disclaimer.
                     25: .\" 2. Redistributions in binary form must reproduce the above copyright
                     26: .\"    notice, this list of conditions and the following disclaimer in the
                     27: .\"    documentation and/or other materials provided with the distribution.
                     28: .\" 3. Neither the name of the University nor the names of its contributors
                     29: .\"    may be used to endorse or promote products derived from this software
                     30: .\"    without specific prior written permission.
                     31: .\"
                     32: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     33: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     34: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     35: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     36: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     37: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     38: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     39: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     40: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     41: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     42: .\" SUCH DAMAGE.
                     43: .\"
                     44: .\"    from: @(#)ktrace.1      8.1 (Berkeley) 6/6/93
                     45: .\"
1.8       jmc        46: .Dd $Mdocdate: September 7 2015 $
1.1       miod       47: .Dt LTRACE 1
                     48: .Os
                     49: .Sh NAME
                     50: .Nm ltrace
                     51: .Nd shared library function call tracer
                     52: .Sh SYNOPSIS
                     53: .Nm ltrace
                     54: .Op Fl ai
                     55: .Op Fl f Ar trfile
1.5       miod       56: .Op Fl t Ar trstr
1.1       miod       57: .Op Fl u Ar trspec
                     58: .Ar command
                     59: .Sh DESCRIPTION
                     60: .Nm ltrace
                     61: enables shared library function calls issued by the specified processes
                     62: to be traced using the
                     63: .Xr utrace 2
                     64: user tracing facility.
                     65: By default, call trace data is logged to the file
                     66: .Pa ktrace.out ,
                     67: unless overridden by the
                     68: .Fl f
                     69: option.
                     70: Each function call is traced as a pair of
                     71: .Dv KTRFAC_USER
                     72: entries;
                     73: the first entry contains the shared library containing the symbol being
                     74: called, and the second entry contains the symbol name.
                     75: .Pp
                     76: Once tracing is enabled on a process, trace data will be logged until
                     77: either the process exits or the trace point is cleared with
                     78: .Xr ktrace 1 .
                     79: A traced process can generate enormous amounts of log data quickly;
                     80: it is strongly suggested that users memorize how to disable tracing before
                     81: attempting to trace a process.
                     82: The following command is sufficient to disable tracing on all user owned
1.6       jmc        83: processes and, if executed by root, all processes:
1.1       miod       84: .Pp
                     85: .Dl $ ktrace -C
                     86: .Pp
                     87: The trace file is not human-readable; use
                     88: .Xr kdump 1
                     89: to decode it.
                     90: .Pp
                     91: The options are as follows:
                     92: .Bl -tag -width 9n
                     93: .It Fl a
                     94: Append to the trace file instead of recreating it.
                     95: .It Fl f Ar trfile
                     96: Log trace records to
                     97: .Ar trfile
                     98: instead of
                     99: .Pa ktrace.out .
                    100: .It Fl i
                    101: Inherit; pass the trace flags to all future children of the designated
                    102: processes.
1.5       miod      103: .It Fl t Ar trstr
                    104: The string argument represents the kernel trace points, one per letter.
                    105: The default flags are
                    106: .Cm c ,
                    107: .Cm i ,
                    108: .Cm n ,
                    109: .Cm s ,
                    110: .Cm t ,
1.9     ! guenther  111: .Cm u ,
1.5       miod      112: and
1.9     ! guenther  113: .Cm x .
1.5       miod      114: The following table equates the letters with the tracepoints:
                    115: .Pp
                    116: .Bl -tag -width flag -offset indent -compact
                    117: .It Cm c
                    118: trace system calls
                    119: .It Cm i
                    120: trace I/O
                    121: .It Cm n
                    122: trace namei translations
                    123: .It Cm s
                    124: trace signal processing
                    125: .It Cm t
                    126: trace various structures
                    127: .It Cm u
                    128: trace user data coming from
                    129: .Xr utrace 2
1.9     ! guenther  130: .It Cm x
        !           131: trace argument vector in
        !           132: .Xr execve 2
        !           133: .It Cm X
        !           134: trace environment in
        !           135: .Xr execve 2
1.5       miod      136: .It Cm +
                    137: trace the default points
1.9     ! guenther  138: .El
1.1       miod      139: .It Fl u Ar trspec
                    140: Restrict the trace to a list of shared objects and/or function names, as
                    141: specified by the
                    142: .Ar trspec
                    143: argument.
                    144: The trace specification is a comma-separated list of library names,
                    145: followed by a colon
1.2       jmc       146: .Pq :\& ,
                    147: and a comma-separated list of function names.
1.1       miod      148: Each list can be empty.
1.2       jmc       149: Each list member may end with a star
1.1       miod      150: .Pq *
                    151: to only match the beginning of a name.
1.4       jmc       152: An exclamation mark at the beginning of a list turns it into a rejection list,
1.1       miod      153: causing all unmatched names to be traced.
                    154: Library names are compared without their version number and
                    155: .Sq .so
                    156: suffix.
1.2       jmc       157: .It Ar command
                    158: Execute
                    159: .Ar command
                    160: with the specified trace flags.
1.1       miod      161: .El
                    162: .Sh FILES
1.2       jmc       163: .Bl -tag -width ktrace.outXXX -compact
1.1       miod      164: .It Pa ktrace.out
1.2       jmc       165: Default
                    166: .Nm
                    167: dump file.
1.1       miod      168: .El
                    169: .Sh EXAMPLES
                    170: Trace all shared library function calls from
                    171: .Xr wc 1
                    172: reading the message of the day:
                    173: .Dl $ ltrace wc -lh /etc/motd
                    174: .Pp
                    175: Trace only the shared library function calls in
                    176: .Pa libutil.so :
                    177: .Dl $ ltrace -u libutil wc -lh /etc/motd
                    178: .Pp
                    179: Trace all the shared library function calls but those in
                    180: .Pa libc.so :
                    181: .Dl $ ltrace -u \(dq!libc\(dq wc -lh /etc/motd
                    182: .Pp
1.2       jmc       183: Trace all the shared library function calls with names starting
1.3       jmc       184: .Qq fmt :
1.1       miod      185: .Dl $ ltrace -u \(dq:fmt*\(dq wc -lh /etc/motd
1.5       miod      186: .Pp
                    187: Trace all shared library function calls, as well as all system calls:
                    188: .Dl $ ltrace -t cu wc -lh /etc/motd
1.1       miod      189: .Sh SEE ALSO
                    190: .Xr kdump 1 ,
                    191: .Xr ktrace 1 ,
                    192: .Xr ktrace 2 ,
                    193: .Xr utrace 2
1.5       miod      194: .Sh HISTORY
                    195: The
                    196: .Nm ltrace
                    197: command appeared in
                    198: .Ox 5.4 .