blob: 43229f5771c4a3c7376c94fedf33a621d41d0606 [file] [log] [blame]
Ian Wienand9a2ad352006-02-20 22:44:45 +01001.\" Copyright (c) 1997-2005 Juan Cespedes <cespedes@debian.org>
Juan Cespedes07461b61997-08-22 15:29:10 +02002.\" This file is covered by the GNU GPL
Ian Wienand9a2ad352006-02-20 22:44:45 +01003.TH ltrace 1
4.SH NAME
Juan Cespedes07461b61997-08-22 15:29:10 +02005ltrace \- A library call tracer
6
Ian Wienand9a2ad352006-02-20 22:44:45 +01007.SH SYNOPSIS
Juan Cespedes07461b61997-08-22 15:29:10 +02008.B ltrace
Ian Wienand9a2ad352006-02-20 22:44:45 +01009.I "[-CdfhiLrStttV] [-a column] [-e expr] [-l filename] [-n nr] [-o filename] [-p pid] ... [-s strsize] [-u username] [-X extern] [-x extern] ... [--align=column] [--debug] [--demangle] [--help] [--indent=nr] [--library=filename] [--output=filename] [--version] [command [arg ...]]"
Juan Cespedes07461b61997-08-22 15:29:10 +020010
Ian Wienand9a2ad352006-02-20 22:44:45 +010011.SH DESCRIPTION
Juan Cespedes07461b61997-08-22 15:29:10 +020012.B ltrace
13is a program that simply runs the specified
14.I command
15until it exits. It intercepts and records the dynamic library calls
16which are called by the executed process and the signals which are
17received by that process.
Juan Cespedesac3db291998-04-25 14:31:58 +020018It can also intercept and print the system calls executed by the program.
Ian Wienand9a2ad352006-02-20 22:44:45 +010019.PP
Juan Cespedes07461b61997-08-22 15:29:10 +020020Its use is very similar to
Juan Cespedes81690ef1998-03-13 19:31:29 +010021.BR strace(1) .
Juan Cespedes07461b61997-08-22 15:29:10 +020022
Ian Wienand9a2ad352006-02-20 22:44:45 +010023.SH OPTIONS
24.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010025.I \-a, \-\-align column
26Align return values in a secific column (default column is 5/8 of screen width).
Ian Wienand9a2ad352006-02-20 22:44:45 +010027.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010028.I \-c
29Count time and calls for each library call and report a summary on program exit.
Ian Wienand9a2ad352006-02-20 22:44:45 +010030.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020031.I \-C, \-\-demangle
Ian Wienand9a2ad352006-02-20 22:44:45 +010032Decode (demangle) low-level symbol names into user-level names.
Juan Cespedesac3db291998-04-25 14:31:58 +020033Besides removing any initial underscore prepended by the system,
34this makes C++ function names readable.
Ian Wienand9a2ad352006-02-20 22:44:45 +010035.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010036.I \-d, \-\-debug
37Increase the debugging level.
38Use more (ie.
Ian Wienand4128b9d2006-02-20 22:54:19 +010039.I \-dd
Juan Cespedesd65efa32003-02-03 00:22:30 +010040) for greater debugging information.
Ian Wienand9a2ad352006-02-20 22:44:45 +010041.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020042.I \-e expr
43A qualifying expression which modifies which events to trace.
44The format of the expression is:
Ian Wienand9a2ad352006-02-20 22:44:45 +010045.br
Juan Cespedesac3db291998-04-25 14:31:58 +020046[!]value1[,value2]...
Ian Wienand9a2ad352006-02-20 22:44:45 +010047.br
Juan Cespedesac3db291998-04-25 14:31:58 +020048where the values are the functions to trace. Using an exclamation
49mark negates the set of values. For example
50.I \-e printf
51means to trace only the printf library call. By contrast,
52.I \-e !printf
53means to trace every library call except printf.
Ian Wienand9a2ad352006-02-20 22:44:45 +010054.IP
Juan Cespedesac3db291998-04-25 14:31:58 +020055Note that some shells use the exclamation point for history
56expansion; even inside quoted arguments. If so, you must escape
57the exclamation point with a backslash.
Ian Wienand9a2ad352006-02-20 22:44:45 +010058.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010059.I \-f
60Trace child processes as they are created by
61currently traced processes as a result of the fork(2)
62or clone(2) system calls.
63The new process is attached as soon as its pid is known.
Ian Wienand9a2ad352006-02-20 22:44:45 +010064.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020065.I \-h, \-\-help
66Show a summary of the options to ltrace and exit.
Ian Wienand9a2ad352006-02-20 22:44:45 +010067.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010068.I \-i
69Print the instruction pointer at the time of the library call.
Ian Wienand9a2ad352006-02-20 22:44:45 +010070.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010071.I \-l, \-\-library filename
72Display only the symbols included in the library
73.I filename.
74Up to 20 library names can be specified with several instances
75of this option.
Ian Wienand9a2ad352006-02-20 22:44:45 +010076.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010077.I \-L
78DON'T display library calls (use it with the
79.I \-S
80option).
Ian Wienand9a2ad352006-02-20 22:44:45 +010081.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010082.I \-n, \-\-indent nr
83Indent trace output by
84.I nr
85number of spaces for each new nested call. Using this option makes
86the program flow visualization easy to follow.
Ian Wienand9a2ad352006-02-20 22:44:45 +010087.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010088.I \-o, \-\-output filename
89Write the trace output to the file
90.I filename
91rather than to stderr.
Ian Wienand9a2ad352006-02-20 22:44:45 +010092.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010093.I \-p pid
94Attach to the process with the process ID
95.I pid
96and begin tracing.
Ian Wienand9a2ad352006-02-20 22:44:45 +010097.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010098.I \-r
99Print a relative timestamp with each line of the trace.
100This records the time difference between the beginning of
101successive lines.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100102.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100103.I \-s strsize
104Specify the maximum string size to print (the default is 32).
Ian Wienand9a2ad352006-02-20 22:44:45 +0100105.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100106.I \-S
107Display system calls as well as library calls
Ian Wienand9a2ad352006-02-20 22:44:45 +0100108.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100109.I \-t
110Prefix each line of the trace with the time of day.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100111.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100112.I \-tt
113If given twice, the time printed will include the microseconds.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100114.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100115.I \-ttt
116If given thrice, the time printed will include the microseconds and
117the leading portion will be printed as the number of seconds since the
118epoch.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100119.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100120.I \-T
121Show the time spent inside each call. This records the time difference
122between the beginning and the end of each call.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100123.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100124.I \-u username
125Run command with the userid, groupid and supplementary groups of
Ian Wienand9a2ad352006-02-20 22:44:45 +0100126.IR username .
Juan Cespedesd65efa32003-02-03 00:22:30 +0100127This option is only useful when running as root and enables the
128correct execution of setuid and/or setgid binaries.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100129.TP
130.I \-X extern
131Some architectures need to know where to set a breakpoint that will be hit
132after the dynamic linker has run. If this flag is used, then the breakpoint
133is set at
134.IR extern ,
135which must be an external function. By default, 'main' is used.
136.TP
137.I \-x extern
138Trace the external function
139.IR extern .
140This option may be repeated.
141.TP
Juan Cespedesac3db291998-04-25 14:31:58 +0200142.I \-V, \-\-version
143Show the version number of ltrace and exit.
Juan Cespedes07461b61997-08-22 15:29:10 +0200144
Ian Wienand9a2ad352006-02-20 22:44:45 +0100145.SH BUGS
Juan Cespedesac3db291998-04-25 14:31:58 +0200146It has most of the bugs stated in
147.BR strace(1) .
Ian Wienand9a2ad352006-02-20 22:44:45 +0100148.LP
149Manual page and documentation are not very up-to-date.
150.LP
151Option -f sometimes fails to trace some children.
152.LP
Juan Cespedes5c3fe062004-06-14 18:08:37 +0200153It only works on Linux and in a small subset of architectures.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100154.LP
Juan Cespedesb1dd77d2002-03-03 00:22:06 +0100155Only ELF32 binaries are supported.
Ian Wienand4128b9d2006-02-20 22:54:19 +0100156.LP
157Calls to dlopen()ed libraries will not be traced.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100158.PP
159If you like to report a bug, send a notice to the author, or use the
160.BR bug(1)
Juan Cespedesac3db291998-04-25 14:31:58 +0200161program if you are under the Debian GNU/Linux distribution.
Juan Cespedes07461b61997-08-22 15:29:10 +0200162
Ian Wienand9a2ad352006-02-20 22:44:45 +0100163.SH FILES
164.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100165.I /etc/ltrace.conf
166System configuration file
Ian Wienand9a2ad352006-02-20 22:44:45 +0100167.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100168.I ~/.ltrace.conf
169Personal config file, overrides
170.I /etc/ltrace.conf
171
Ian Wienand9a2ad352006-02-20 22:44:45 +0100172.SH AUTHOR
Juan Cespedes64e793b1997-09-11 23:22:36 +0200173Juan Cespedes <cespedes@debian.org>
Juan Cespedes07461b61997-08-22 15:29:10 +0200174
175.SH "SEE ALSO"
176.BR strace(1) ,
177.BR ptrace(2)
178