blob: f9565e9d263f21f32185ba3976d9a98f61d6bb6f [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
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
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.
Justin Pryzbyfda2c6f2006-07-18 00:05:26 +020033Besides removing any initial underscore prefix used by the system,
Juan Cespedesac3db291998-04-25 14:31:58 +020034this 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
Steve Fink58c73a72006-07-17 23:18:35 +020065.I \-F
66Load an alternate config file. Normally, /etc/ltrace.conf and
67~/.ltrace.conf will be read (the latter only if it exists).
68Use this option to load the given file or files instead of
69those two default files.
70.TP
Juan Cespedesac3db291998-04-25 14:31:58 +020071.I \-h, \-\-help
72Show a summary of the options to ltrace and exit.
Ian Wienand9a2ad352006-02-20 22:44:45 +010073.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010074.I \-i
75Print the instruction pointer at the time of the library call.
Ian Wienand9a2ad352006-02-20 22:44:45 +010076.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010077.I \-l, \-\-library filename
78Display only the symbols included in the library
79.I filename.
80Up to 20 library names can be specified with several instances
81of this option.
Ian Wienand9a2ad352006-02-20 22:44:45 +010082.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010083.I \-L
84DON'T display library calls (use it with the
85.I \-S
86option).
Ian Wienand9a2ad352006-02-20 22:44:45 +010087.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010088.I \-n, \-\-indent nr
89Indent trace output by
90.I nr
91number of spaces for each new nested call. Using this option makes
92the program flow visualization easy to follow.
Ian Wienand9a2ad352006-02-20 22:44:45 +010093.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010094.I \-o, \-\-output filename
95Write the trace output to the file
96.I filename
97rather than to stderr.
Ian Wienand9a2ad352006-02-20 22:44:45 +010098.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +010099.I \-p pid
100Attach to the process with the process ID
101.I pid
102and begin tracing.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100103.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100104.I \-r
105Print a relative timestamp with each line of the trace.
106This records the time difference between the beginning of
107successive lines.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100108.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100109.I \-s strsize
110Specify the maximum string size to print (the default is 32).
Ian Wienand9a2ad352006-02-20 22:44:45 +0100111.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100112.I \-S
113Display system calls as well as library calls
Ian Wienand9a2ad352006-02-20 22:44:45 +0100114.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100115.I \-t
116Prefix each line of the trace with the time of day.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100117.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100118.I \-tt
119If given twice, the time printed will include the microseconds.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100120.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100121.I \-ttt
122If given thrice, the time printed will include the microseconds and
123the leading portion will be printed as the number of seconds since the
124epoch.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100125.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100126.I \-T
127Show the time spent inside each call. This records the time difference
128between the beginning and the end of each call.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100129.TP
Juan Cespedesd65efa32003-02-03 00:22:30 +0100130.I \-u username
131Run command with the userid, groupid and supplementary groups of
Ian Wienand9a2ad352006-02-20 22:44:45 +0100132.IR username .
Juan Cespedesd65efa32003-02-03 00:22:30 +0100133This option is only useful when running as root and enables the
134correct execution of setuid and/or setgid binaries.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100135.TP
136.I \-X extern
137Some architectures need to know where to set a breakpoint that will be hit
138after the dynamic linker has run. If this flag is used, then the breakpoint
139is set at
140.IR extern ,
Paul Gilliambe320772006-04-24 22:06:23 +0200141which must be an external function. By default, '_start' is used.
142NOTE: this flag is only available on the architectures that need it.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100143.TP
144.I \-x extern
145Trace the external function
146.IR extern .
147This option may be repeated.
148.TP
Juan Cespedesac3db291998-04-25 14:31:58 +0200149.I \-V, \-\-version
150Show the version number of ltrace and exit.
Juan Cespedes07461b61997-08-22 15:29:10 +0200151
Ian Wienand9a2ad352006-02-20 22:44:45 +0100152.SH BUGS
Juan Cespedesac3db291998-04-25 14:31:58 +0200153It has most of the bugs stated in
154.BR strace(1) .
Ian Wienand9a2ad352006-02-20 22:44:45 +0100155.LP
156Manual page and documentation are not very up-to-date.
157.LP
158Option -f sometimes fails to trace some children.
159.LP
Juan Cespedes5c3fe062004-06-14 18:08:37 +0200160It only works on Linux and in a small subset of architectures.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100161.LP
Juan Cespedesb1dd77d2002-03-03 00:22:06 +0100162Only ELF32 binaries are supported.
Ian Wienand4128b9d2006-02-20 22:54:19 +0100163.LP
164Calls to dlopen()ed libraries will not be traced.
Ian Wienand9a2ad352006-02-20 22:44:45 +0100165.PP
Steve Fink7ab8df12006-08-07 04:06:16 +0200166If you would like to report a bug, send a message to the mailing list
167(ltrace-devel@lists.alioth.debian.org), or use the
Ian Wienandbf312a12006-02-20 23:28:35 +0100168.BR reportbug(1)
Juan Cespedesac3db291998-04-25 14:31:58 +0200169program if you are under the Debian GNU/Linux distribution.
Juan Cespedes07461b61997-08-22 15:29:10 +0200170
Ian Wienand9a2ad352006-02-20 22:44:45 +0100171.SH FILES
172.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100173.I /etc/ltrace.conf
174System configuration file
Ian Wienand9a2ad352006-02-20 22:44:45 +0100175.TP
Juan Cespedes5e01f651998-03-08 22:31:44 +0100176.I ~/.ltrace.conf
177Personal config file, overrides
178.I /etc/ltrace.conf
179
Ian Wienand9a2ad352006-02-20 22:44:45 +0100180.SH AUTHOR
Juan Cespedes64e793b1997-09-11 23:22:36 +0200181Juan Cespedes <cespedes@debian.org>
Juan Cespedes07461b61997-08-22 15:29:10 +0200182
183.SH "SEE ALSO"
184.BR strace(1) ,
185.BR ptrace(2)
186