blob: 5eba8b54e6c761ce2aab9514448ad500cc10ab32 [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
Juan Cespedescd8976d2009-05-14 13:47:58 +02009.I "[-CfhiLrStttV] [-a column] [-A maxelts] [-d level] [-e expr] [-l filename] [-n nr] [-o filename] [-p pid] ... [-s strsize] [-u username] [-X extern] [-x extern] ... [--align=column] [--debug=level] [--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
Justin Pryzby1b98b342006-06-16 03:15:18 +020026Align return values in a specific column (default column is 5/8 of screen width).
Ian Wienand9a2ad352006-02-20 22:44:45 +010027.TP
Steve Fink1150bc42006-08-07 06:04:43 +020028.I \-A maxelts
29Maximum number of array elements to print before suppressing the rest with an ellipsis ("...")
30.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010031.I \-c
32Count time and calls for each library call and report a summary on program exit.
Ian Wienand9a2ad352006-02-20 22:44:45 +010033.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020034.I \-C, \-\-demangle
Ian Wienand9a2ad352006-02-20 22:44:45 +010035Decode (demangle) low-level symbol names into user-level names.
Justin Pryzbyfda2c6f2006-07-18 00:05:26 +020036Besides removing any initial underscore prefix used by the system,
Juan Cespedesac3db291998-04-25 14:31:58 +020037this makes C++ function names readable.
Ian Wienand9a2ad352006-02-20 22:44:45 +010038.TP
Juan Cespedescd8976d2009-05-14 13:47:58 +020039.I \-d, \-\-debug level
40Show debugging output of
41.B ltrace
42itself.
43.I level
44must be a sum of some of the following numbers:
45.RS
46.TP
47.B 0x10
48DEBUG_EVENT. Shows every event received by a traced program
49.TP
50.B 0x20
Juan Cespedes85f7d762009-05-14 13:53:59 +020051DEBUG_PROCESS. Shows every action
52.B ltrace
53carries upon a traced program
Juan Cespedescd8976d2009-05-14 13:47:58 +020054.RE
Ian Wienand9a2ad352006-02-20 22:44:45 +010055.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020056.I \-e expr
57A qualifying expression which modifies which events to trace.
58The format of the expression is:
Ian Wienand9a2ad352006-02-20 22:44:45 +010059.br
Juan Cespedesac3db291998-04-25 14:31:58 +020060[!]value1[,value2]...
Ian Wienand9a2ad352006-02-20 22:44:45 +010061.br
Juan Cespedesac3db291998-04-25 14:31:58 +020062where the values are the functions to trace. Using an exclamation
63mark negates the set of values. For example
64.I \-e printf
65means to trace only the printf library call. By contrast,
66.I \-e !printf
67means to trace every library call except printf.
Ian Wienand9a2ad352006-02-20 22:44:45 +010068.IP
Juan Cespedesac3db291998-04-25 14:31:58 +020069Note that some shells use the exclamation point for history
70expansion; even inside quoted arguments. If so, you must escape
71the exclamation point with a backslash.
Ian Wienand9a2ad352006-02-20 22:44:45 +010072.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010073.I \-f
74Trace child processes as they are created by
Juan Cespedesc4e53a92009-05-06 20:36:42 +020075currently traced processes as a result of the fork(2)
Juan Cespedesd65efa32003-02-03 00:22:30 +010076or clone(2) system calls.
Juan Cespedesc4e53a92009-05-06 20:36:42 +020077The new process is attached immediately.
Ian Wienand9a2ad352006-02-20 22:44:45 +010078.TP
Steve Fink58c73a72006-07-17 23:18:35 +020079.I \-F
80Load an alternate config file. Normally, /etc/ltrace.conf and
81~/.ltrace.conf will be read (the latter only if it exists).
82Use this option to load the given file or files instead of
83those two default files.
84.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020085.I \-h, \-\-help
86Show a summary of the options to ltrace and exit.
Ian Wienand9a2ad352006-02-20 22:44:45 +010087.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010088.I \-i
89Print the instruction pointer at the time of the library call.
Ian Wienand9a2ad352006-02-20 22:44:45 +010090.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010091.I \-l, \-\-library filename
92Display only the symbols included in the library
93.I filename.
Juan Cespedesaee09312007-08-31 18:49:48 +020094Up to 30 library names can be specified with several instances
Juan Cespedesd65efa32003-02-03 00:22:30 +010095of this option.
Ian Wienand9a2ad352006-02-20 22:44:45 +010096.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010097.I \-L
98DON'T display library calls (use it with the
99.I \-S
100option).
Ian Wienand9a2ad352006-02-20 22:44:45 +0100101.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100102.I \-n, \-\-indent nr
103Indent trace output by
104.I nr
105number of spaces for each new nested call. Using this option makes
106the program flow visualization easy to follow.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100107.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100108.I \-o, \-\-output filename
109Write the trace output to the file
110.I filename
111rather than to stderr.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100112.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100113.I \-p pid
114Attach to the process with the process ID
115.I pid
116and begin tracing.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100117.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100118.I \-r
119Print a relative timestamp with each line of the trace.
120This records the time difference between the beginning of
121successive lines.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100122.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100123.I \-s strsize
124Specify the maximum string size to print (the default is 32).
Ian Wienand9a2ad352006-02-20 22:44:45 +0100125.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100126.I \-S
127Display system calls as well as library calls
Ian Wienand9a2ad352006-02-20 22:44:45 +0100128.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100129.I \-t
130Prefix each line of the trace with the time of day.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100131.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100132.I \-tt
133If given twice, the time printed will include the microseconds.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100134.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100135.I \-ttt
136If given thrice, the time printed will include the microseconds and
137the leading portion will be printed as the number of seconds since the
138epoch.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100139.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100140.I \-T
141Show the time spent inside each call. This records the time difference
142between the beginning and the end of each call.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100143.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100144.I \-u username
145Run command with the userid, groupid and supplementary groups of
Ian Wienand9a2ad352006-02-20 22:44:45 +0100146.IR username .
Juan Cespedesd65efa32003-02-03 00:22:30 +0100147This option is only useful when running as root and enables the
148correct execution of setuid and/or setgid binaries.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100149.TP
150.I \-X extern
151Some architectures need to know where to set a breakpoint that will be hit
152after the dynamic linker has run. If this flag is used, then the breakpoint
153is set at
154.IR extern ,
Paul Gilliambe320772006-04-24 22:06:23 +0200155which must be an external function. By default, '_start' is used.
156NOTE: this flag is only available on the architectures that need it.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100157.TP
158.I \-x extern
159Trace the external function
160.IR extern .
161This option may be repeated.
162.TP
Juan Cespedesac3db291998-04-25 14:31:58 +0200163.I \-V, \-\-version
164Show the version number of ltrace and exit.
Juan Cespedes07461b61997-08-22 15:29:10 +0200165
Ian Wienand9a2ad352006-02-20 22:44:45 +0100166.SH BUGS
Juan Cespedesac3db291998-04-25 14:31:58 +0200167It has most of the bugs stated in
168.BR strace(1) .
Ian Wienand9a2ad352006-02-20 22:44:45 +0100169.LP
170Manual page and documentation are not very up-to-date.
171.LP
172Option -f sometimes fails to trace some children.
173.LP
Juan Cespedes5c3fe062004-06-14 18:08:37 +0200174It only works on Linux and in a small subset of architectures.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100175.LP
Juan Cespedesb1dd77d2002-03-03 00:22:06 +0100176Only ELF32 binaries are supported.
Ian Wienand4128b9d2006-02-20 22:54:19 +0100177.LP
178Calls to dlopen()ed libraries will not be traced.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100179.PP
Steve Fink7ab8df12006-08-07 04:06:16 +0200180If you would like to report a bug, send a message to the mailing list
181(ltrace-devel@lists.alioth.debian.org), or use the
Ian Wienandbf312a12006-02-20 23:28:35 +0100182.BR reportbug(1)
Juan Cespedesac3db291998-04-25 14:31:58 +0200183program if you are under the Debian GNU/Linux distribution.
Juan Cespedes07461b61997-08-22 15:29:10 +0200184
Ian Wienand9a2ad352006-02-20 22:44:45 +0100185.SH FILES
186.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100187.I /etc/ltrace.conf
188System configuration file
Ian Wienand9a2ad352006-02-20 22:44:45 +0100189.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100190.I ~/.ltrace.conf
191Personal config file, overrides
192.I /etc/ltrace.conf
193
Ian Wienand9a2ad352006-02-20 22:44:45 +0100194.SH AUTHOR
Juan Cespedes64e793b1997-09-11 23:22:36 +0200195Juan Cespedes <cespedes@debian.org>
Juan Cespedes07461b61997-08-22 15:29:10 +0200196
197.SH "SEE ALSO"
198.BR strace(1) ,
199.BR ptrace(2)
200