blob: a96fc34e5eaa08fd36b7659656b97a7a910e260d [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
Juan Cespedesfea4a122009-05-28 16:53:43 +02003.TH ltrace 1
Ian Wienand9a2ad352006-02-20 22:44:45 +01004.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
Joe Damato59e3fb12009-11-06 19:45:10 -08009.I "[-bCfghiLrStttV] [-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
Joe Damatofa2aefc2010-10-30 19:56:50 -070026Align return values in a specific
27.IR column
28(default column is 5/8 of screen width).
Ian Wienand9a2ad352006-02-20 22:44:45 +010029.TP
Steve Fink1150bc42006-08-07 06:04:43 +020030.I \-A maxelts
31Maximum number of array elements to print before suppressing the rest with an ellipsis ("...")
32.TP
Joe Damato59e3fb12009-11-06 19:45:10 -080033.I \-b, \-\-no-signals
34Disable printing of signals recieved by the traced process.
35.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010036.I \-c
37Count time and calls for each library call and report a summary on program exit.
Ian Wienand9a2ad352006-02-20 22:44:45 +010038.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020039.I \-C, \-\-demangle
Ian Wienand9a2ad352006-02-20 22:44:45 +010040Decode (demangle) low-level symbol names into user-level names.
Justin Pryzbyfda2c6f2006-07-18 00:05:26 +020041Besides removing any initial underscore prefix used by the system,
Juan Cespedesac3db291998-04-25 14:31:58 +020042this makes C++ function names readable.
Ian Wienand9a2ad352006-02-20 22:44:45 +010043.TP
Juan Cespedesc5c744a2009-07-23 18:22:58 +020044.I \-D, \-\-debug level
Juan Cespedescd8976d2009-05-14 13:47:58 +020045Show debugging output of
46.B ltrace
47itself.
48.I level
49must be a sum of some of the following numbers:
50.RS
51.TP
Juan Cespedesc5c744a2009-07-23 18:22:58 +020052.B 01
53DEBUG_GENERAL. Shows helpful progress information
54.TP
55.B 010
Juan Cespedescd8976d2009-05-14 13:47:58 +020056DEBUG_EVENT. Shows every event received by a traced program
57.TP
Juan Cespedesc5c744a2009-07-23 18:22:58 +020058.B 020
Juan Cespedes85f7d762009-05-14 13:53:59 +020059DEBUG_PROCESS. Shows every action
60.B ltrace
Juan Cespedesc5c744a2009-07-23 18:22:58 +020061carries upon a traced process
62.TP
63.B 040
64DEBUG_FUNCTION. Shows every entry to internal functions
Juan Cespedescd8976d2009-05-14 13:47:58 +020065.RE
Ian Wienand9a2ad352006-02-20 22:44:45 +010066.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020067.I \-e expr
68A qualifying expression which modifies which events to trace.
69The format of the expression is:
Ian Wienand9a2ad352006-02-20 22:44:45 +010070.br
Juan Cespedesac3db291998-04-25 14:31:58 +020071[!]value1[,value2]...
Ian Wienand9a2ad352006-02-20 22:44:45 +010072.br
Juan Cespedesac3db291998-04-25 14:31:58 +020073where the values are the functions to trace. Using an exclamation
74mark negates the set of values. For example
75.I \-e printf
76means to trace only the printf library call. By contrast,
77.I \-e !printf
78means to trace every library call except printf.
Ian Wienand9a2ad352006-02-20 22:44:45 +010079.IP
Juan Cespedesac3db291998-04-25 14:31:58 +020080Note that some shells use the exclamation point for history
81expansion; even inside quoted arguments. If so, you must escape
82the exclamation point with a backslash.
Ian Wienand9a2ad352006-02-20 22:44:45 +010083.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010084.I \-f
85Trace child processes as they are created by
Juan Cespedesc4e53a92009-05-06 20:36:42 +020086currently traced processes as a result of the fork(2)
Juan Cespedesd65efa32003-02-03 00:22:30 +010087or clone(2) system calls.
Juan Cespedesc4e53a92009-05-06 20:36:42 +020088The new process is attached immediately.
Ian Wienand9a2ad352006-02-20 22:44:45 +010089.TP
Joe Damatofa2aefc2010-10-30 19:56:50 -070090.I \-g
91Do not place breakpoints on PLT entries. This option reduces
92the output of ltrace. This is commonly used to avoid tracing
93libc functions.
94.TP
Steve Fink58c73a72006-07-17 23:18:35 +020095.I \-F
96Load an alternate config file. Normally, /etc/ltrace.conf and
97~/.ltrace.conf will be read (the latter only if it exists).
98Use this option to load the given file or files instead of
99those two default files.
100.TP
Juan Cespedesac3db291998-04-25 14:31:58 +0200101.I \-h, \-\-help
102Show a summary of the options to ltrace and exit.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100103.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100104.I \-i
105Print the instruction pointer at the time of the library call.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100106.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100107.I \-l, \-\-library filename
108Display only the symbols included in the library
109.I filename.
Juan Cespedesaee09312007-08-31 18:49:48 +0200110Up to 30 library names can be specified with several instances
Juan Cespedesd65efa32003-02-03 00:22:30 +0100111of this option.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100112.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100113.I \-L
114DON'T display library calls (use it with the
115.I \-S
116option).
Ian Wienand9a2ad352006-02-20 22:44:45 +0100117.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100118.I \-n, \-\-indent nr
119Indent trace output by
120.I nr
121number of spaces for each new nested call. Using this option makes
122the program flow visualization easy to follow.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100123.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100124.I \-o, \-\-output filename
125Write the trace output to the file
126.I filename
127rather than to stderr.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100128.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100129.I \-p pid
130Attach to the process with the process ID
131.I pid
132and begin tracing.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100133.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100134.I \-r
135Print a relative timestamp with each line of the trace.
136This records the time difference between the beginning of
137successive lines.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100138.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100139.I \-s strsize
140Specify the maximum string size to print (the default is 32).
Ian Wienand9a2ad352006-02-20 22:44:45 +0100141.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100142.I \-S
143Display system calls as well as library calls
Ian Wienand9a2ad352006-02-20 22:44:45 +0100144.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100145.I \-t
146Prefix each line of the trace with the time of day.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100147.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100148.I \-tt
149If given twice, the time printed will include the microseconds.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100150.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100151.I \-ttt
152If given thrice, the time printed will include the microseconds and
153the leading portion will be printed as the number of seconds since the
154epoch.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100155.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100156.I \-T
157Show the time spent inside each call. This records the time difference
158between the beginning and the end of each call.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100159.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100160.I \-u username
161Run command with the userid, groupid and supplementary groups of
Ian Wienand9a2ad352006-02-20 22:44:45 +0100162.IR username .
Juan Cespedesd65efa32003-02-03 00:22:30 +0100163This option is only useful when running as root and enables the
164correct execution of setuid and/or setgid binaries.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100165.TP
166.I \-X extern
167Some architectures need to know where to set a breakpoint that will be hit
168after the dynamic linker has run. If this flag is used, then the breakpoint
169is set at
170.IR extern ,
Paul Gilliambe320772006-04-24 22:06:23 +0200171which must be an external function. By default, '_start' is used.
172NOTE: this flag is only available on the architectures that need it.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100173.TP
174.I \-x extern
175Trace the external function
176.IR extern .
177This option may be repeated.
178.TP
Juan Cespedesac3db291998-04-25 14:31:58 +0200179.I \-V, \-\-version
180Show the version number of ltrace and exit.
Juan Cespedes07461b61997-08-22 15:29:10 +0200181
Ian Wienand9a2ad352006-02-20 22:44:45 +0100182.SH BUGS
Juan Cespedesac3db291998-04-25 14:31:58 +0200183It has most of the bugs stated in
184.BR strace(1) .
Ian Wienand9a2ad352006-02-20 22:44:45 +0100185.LP
186Manual page and documentation are not very up-to-date.
187.LP
188Option -f sometimes fails to trace some children.
189.LP
Juan Cespedes5c3fe062004-06-14 18:08:37 +0200190It only works on Linux and in a small subset of architectures.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100191.LP
Juan Cespedesb1dd77d2002-03-03 00:22:06 +0100192Only ELF32 binaries are supported.
Ian Wienand4128b9d2006-02-20 22:54:19 +0100193.LP
194Calls to dlopen()ed libraries will not be traced.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100195.PP
Steve Fink7ab8df12006-08-07 04:06:16 +0200196If you would like to report a bug, send a message to the mailing list
197(ltrace-devel@lists.alioth.debian.org), or use the
Ian Wienandbf312a12006-02-20 23:28:35 +0100198.BR reportbug(1)
Juan Cespedesac3db291998-04-25 14:31:58 +0200199program if you are under the Debian GNU/Linux distribution.
Juan Cespedes07461b61997-08-22 15:29:10 +0200200
Ian Wienand9a2ad352006-02-20 22:44:45 +0100201.SH FILES
202.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100203.I /etc/ltrace.conf
204System configuration file
Ian Wienand9a2ad352006-02-20 22:44:45 +0100205.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100206.I ~/.ltrace.conf
207Personal config file, overrides
208.I /etc/ltrace.conf
209
Ian Wienand9a2ad352006-02-20 22:44:45 +0100210.SH AUTHOR
Juan Cespedes64e793b1997-09-11 23:22:36 +0200211Juan Cespedes <cespedes@debian.org>
Juan Cespedes07461b61997-08-22 15:29:10 +0200212
213.SH "SEE ALSO"
214.BR strace(1) ,
215.BR ptrace(2)
216