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 --dl When a dlopened library is mapped in the process address space,
45 put breakpoints to all symbols in the dynamic symbol table of
46 that library.
47
48 -e expr
49 A qualifying expression which modifies which events to trace.
50 The format of the expression is:
51 [!]value1[,value2]...
52 where the values are the functions to trace. Using an exclama‐
53 tion mark negates the set of values. For example -e printf
54 means to trace only the printf library call. By contrast, -e
55 !printf means to trace every library call except printf.
56
57 Note that some shells use the exclamation point for history
58 expansion; even inside quoted arguments. If so, you must escape
59 the exclamation point with a backslash.
60
61 -f Trace child processes as they are created by currently traced
62 processes as a result of the fork(2) or clone(2) system calls.
63 The new process is attached as soon as its pid is known.
64
65 -h, --help
66 Show a summary of the options to ltrace and exit.
67
68 -i Print the instruction pointer at the time of the library call.
69
70 -l, --library filename
71 Display only the symbols included in the library filename. Up
72 to 20 library names can be specified with several instances of
73 this option.
74
75 -L DON'T display library calls (use it with the -S option).
76
77 -n, --indent nr
78 Indent trace output by nr number of spaces for each new nested
79 call. Using this option makes the program flow visualization
80 easy to follow.
81
82 -o, --output filename
83 Write the trace output to the file filename rather than to
84 stderr.
85
86 -p pid Attach to the process with the process ID pid and begin tracing.
87
88 -r Print a relative timestamp with each line of the trace. This
89 records the time difference between the beginning of successive
90 lines.
91
92 -s strsize
93 Specify the maximum string size to print (the default is 32).
94
95 -S Display system calls as well as library calls
96
97 -t Prefix each line of the trace with the time of day.
98
99 -tt If given twice, the time printed will include the microseconds.
100
101 -ttt If given thrice, the time printed will include the microseconds
102 and the leading portion will be printed as the number of seconds
103 since the epoch.
104
105 -T Show the time spent inside each call. This records the time
106 difference between the beginning and the end of each call.
107
108 -u username
109 Run command with the userid, groupid and supplementary groups of
110 username. This option is only useful when running as root and
111 enables the correct execution of setuid and/or setgid binaries.
112
113 -X extern
114 Some architectures need to know where to set a breakpoint that
115 will be hit after the dynamic linker has run. If this flag is
116 used, then the breakpoint is set at extern, which must be an
117 external function. By default, '_start' is used. NOTE: this
118 flag is only available on the architectures that need it.
119
120 -x extern
121 Trace the external function extern. This option may be
122 repeated.
123
124 -V, --version
125 Show the version number of ltrace and exit.
126
127
129 It has most of the bugs stated in strace(1).
130
131 Manual page and documentation are not very up-to-date.
132
133 Option -f sometimes fails to trace some children.
134
135 It only works on Linux and in a small subset of architectures.
136
137 If you like to report a bug, send a notice to the author, or use the
138 reportbug(1) program if you are under the Debian GNU/Linux distribu‐
139 tion.
140
141
143 /etc/ltrace.conf
144 System configuration file
145
146 ~/.ltrace.conf
147 Personal config file, overrides /etc/ltrace.conf
148
149
151 Juan Cespedes <cespedes@debian.org>
152
153
155 strace(1), ptrace(2)
156
157
158
159
160 ltrace(1)