1ltrace(1) General Commands Manual ltrace(1)
2
3
4
6 ltrace - A library call tracer
7
8
10 ltrace [-CdfhiLrStttV] [-a column] [-e expr] [-l filename] [-n nr] [-o
11 filename] [-p pid] ... [-s strsize] [-u username] [-X extern] [-x
12 extern] ... [--align=column] [--debug] [--demangle] [--help]
13 [--indent=nr] [--library=filename] [--output=filename] [--version]
14 [command [arg ...]]
15
16
18 ltrace is a program that simply runs the specified command until it
19 exits. It intercepts and records the dynamic library calls which are
20 called by the executed process and the signals which are received by
21 that process. It can also intercept and print the system calls exe‐
22 cuted by the program.
23
24 Its use is very similar to strace(1).
25
26
28 -a, --align column
29 Align return values in a specific column (default column is 5/8
30 of screen width).
31
32 -c Count time and calls for each library call and report a summary
33 on program exit.
34
35 -C, --demangle
36 Decode (demangle) low-level symbol names into user-level names.
37 Besides removing any initial underscore prepended by the system,
38 this makes C++ function names readable.
39
40 -d, --debug
41 Increase the debugging level. Use more (ie. -dd ) for greater
42 debugging information.
43
44 -e expr
45 A qualifying expression which modifies which events to trace.
46 The format of the expression is:
47 [!]value1[,value2]...
48 where the values are the functions to trace. Using an exclama‐
49 tion mark negates the set of values. For example -e printf
50 means to trace only the printf library call. By contrast, -e
51 !printf means to trace every library call except printf.
52
53 Note that some shells use the exclamation point for history
54 expansion; even inside quoted arguments. If so, you must escape
55 the exclamation point with a backslash.
56
57 -f Trace child processes as they are created by currently traced
58 processes as a result of the fork(2) or clone(2) system calls.
59 The new process is attached as soon as its pid is known.
60
61 -h, --help
62 Show a summary of the options to ltrace and exit.
63
64 -i Print the instruction pointer at the time of the library call.
65
66 -l, --library filename
67 Display only the symbols included in the library filename. Up
68 to 20 library names can be specified with several instances of
69 this option.
70
71 -L DON'T display library calls (use it with the -S option).
72
73 -n, --indent nr
74 Indent trace output by nr number of spaces for each new nested
75 call. Using this option makes the program flow visualization
76 easy to follow.
77
78 -o, --output filename
79 Write the trace output to the file filename rather than to
80 stderr.
81
82 -p pid Attach to the process with the process ID pid and begin tracing.
83
84 -r Print a relative timestamp with each line of the trace. This
85 records the time difference between the beginning of successive
86 lines.
87
88 -s strsize
89 Specify the maximum string size to print (the default is 32).
90
91 -S Display system calls as well as library calls
92
93 -t Prefix each line of the trace with the time of day.
94
95 -tt If given twice, the time printed will include the microseconds.
96
97 -ttt If given thrice, the time printed will include the microseconds
98 and the leading portion will be printed as the number of seconds
99 since the epoch.
100
101 -T Show the time spent inside each call. This records the time
102 difference between the beginning and the end of each call.
103
104 -u username
105 Run command with the userid, groupid and supplementary groups of
106 username. This option is only useful when running as root and
107 enables the correct execution of setuid and/or setgid binaries.
108
109 -X extern
110 Some architectures need to know where to set a breakpoint that
111 will be hit after the dynamic linker has run. If this flag is
112 used, then the breakpoint is set at extern, which must be an
113 external function. By default, '_start' is used. NOTE: this
114 flag is only available on the architectures that need it.
115
116 -x extern
117 Trace the external function extern. This option may be
118 repeated.
119
120 -V, --version
121 Show the version number of ltrace and exit.
122
123
125 It has most of the bugs stated in strace(1).
126
127 Manual page and documentation are not very up-to-date.
128
129 Option -f sometimes fails to trace some children.
130
131 It only works on Linux and in a small subset of architectures.
132
133 Calls to dlopen()ed libraries will not be traced.
134
135 If you like to report a bug, send a notice to the author, or use the
136 reportbug(1) program if you are under the Debian GNU/Linux distribu‐
137 tion.
138
139
141 /etc/ltrace.conf
142 System configuration file
143
144 ~/.ltrace.conf
145 Personal config file, overrides /etc/ltrace.conf
146
147
149 Juan Cespedes <cespedes@debian.org>
150
151
153 strace(1), ptrace(2)
154
155
156
157
158 ltrace(1)