Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 1 | .\" Copyright (c) 1997-2005 Juan Cespedes <cespedes@debian.org> |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 2 | .\" This file is covered by the GNU GPL |
Juan Cespedes | fea4a12 | 2009-05-28 16:53:43 +0200 | [diff] [blame] | 3 | .TH ltrace 1 |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 4 | .SH NAME |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 5 | ltrace \- A library call tracer |
| 6 | |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 7 | .SH SYNOPSIS |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 8 | .B ltrace |
Joe Damato | fa2aefc | 2010-10-30 19:56:50 -0700 | [diff] [blame^] | 9 | .I "[-CfghiLrStttV] [-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 Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 10 | |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 11 | .SH DESCRIPTION |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 12 | .B ltrace |
| 13 | is a program that simply runs the specified |
| 14 | .I command |
| 15 | until it exits. It intercepts and records the dynamic library calls |
| 16 | which are called by the executed process and the signals which are |
| 17 | received by that process. |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 18 | It can also intercept and print the system calls executed by the program. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 19 | .PP |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 20 | Its use is very similar to |
Juan Cespedes | 81690ef | 1998-03-13 19:31:29 +0100 | [diff] [blame] | 21 | .BR strace(1) . |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 22 | |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 23 | .SH OPTIONS |
| 24 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 25 | .I \-a, \-\-align column |
Joe Damato | fa2aefc | 2010-10-30 19:56:50 -0700 | [diff] [blame^] | 26 | Align return values in a specific |
| 27 | .IR column |
| 28 | (default column is 5/8 of screen width). |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 29 | .TP |
Steve Fink | 1150bc4 | 2006-08-07 06:04:43 +0200 | [diff] [blame] | 30 | .I \-A maxelts |
| 31 | Maximum number of array elements to print before suppressing the rest with an ellipsis ("...") |
| 32 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 33 | .I \-c |
| 34 | Count time and calls for each library call and report a summary on program exit. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 35 | .TP |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 36 | .I \-C, \-\-demangle |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 37 | Decode (demangle) low-level symbol names into user-level names. |
Justin Pryzby | fda2c6f | 2006-07-18 00:05:26 +0200 | [diff] [blame] | 38 | Besides removing any initial underscore prefix used by the system, |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 39 | this makes C++ function names readable. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 40 | .TP |
Juan Cespedes | c5c744a | 2009-07-23 18:22:58 +0200 | [diff] [blame] | 41 | .I \-D, \-\-debug level |
Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 42 | Show debugging output of |
| 43 | .B ltrace |
| 44 | itself. |
| 45 | .I level |
| 46 | must be a sum of some of the following numbers: |
| 47 | .RS |
| 48 | .TP |
Juan Cespedes | c5c744a | 2009-07-23 18:22:58 +0200 | [diff] [blame] | 49 | .B 01 |
| 50 | DEBUG_GENERAL. Shows helpful progress information |
| 51 | .TP |
| 52 | .B 010 |
Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 53 | DEBUG_EVENT. Shows every event received by a traced program |
| 54 | .TP |
Juan Cespedes | c5c744a | 2009-07-23 18:22:58 +0200 | [diff] [blame] | 55 | .B 020 |
Juan Cespedes | 85f7d76 | 2009-05-14 13:53:59 +0200 | [diff] [blame] | 56 | DEBUG_PROCESS. Shows every action |
| 57 | .B ltrace |
Juan Cespedes | c5c744a | 2009-07-23 18:22:58 +0200 | [diff] [blame] | 58 | carries upon a traced process |
| 59 | .TP |
| 60 | .B 040 |
| 61 | DEBUG_FUNCTION. Shows every entry to internal functions |
Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 62 | .RE |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 63 | .TP |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 64 | .I \-e expr |
| 65 | A qualifying expression which modifies which events to trace. |
| 66 | The format of the expression is: |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 67 | .br |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 68 | [!]value1[,value2]... |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 69 | .br |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 70 | where the values are the functions to trace. Using an exclamation |
| 71 | mark negates the set of values. For example |
| 72 | .I \-e printf |
| 73 | means to trace only the printf library call. By contrast, |
| 74 | .I \-e !printf |
| 75 | means to trace every library call except printf. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 76 | .IP |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 77 | Note that some shells use the exclamation point for history |
| 78 | expansion; even inside quoted arguments. If so, you must escape |
| 79 | the exclamation point with a backslash. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 80 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 81 | .I \-f |
| 82 | Trace child processes as they are created by |
Juan Cespedes | c4e53a9 | 2009-05-06 20:36:42 +0200 | [diff] [blame] | 83 | currently traced processes as a result of the fork(2) |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 84 | or clone(2) system calls. |
Juan Cespedes | c4e53a9 | 2009-05-06 20:36:42 +0200 | [diff] [blame] | 85 | The new process is attached immediately. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 86 | .TP |
Joe Damato | fa2aefc | 2010-10-30 19:56:50 -0700 | [diff] [blame^] | 87 | .I \-g |
| 88 | Do not place breakpoints on PLT entries. This option reduces |
| 89 | the output of ltrace. This is commonly used to avoid tracing |
| 90 | libc functions. |
| 91 | .TP |
Steve Fink | 58c73a7 | 2006-07-17 23:18:35 +0200 | [diff] [blame] | 92 | .I \-F |
| 93 | Load an alternate config file. Normally, /etc/ltrace.conf and |
| 94 | ~/.ltrace.conf will be read (the latter only if it exists). |
| 95 | Use this option to load the given file or files instead of |
| 96 | those two default files. |
| 97 | .TP |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 98 | .I \-h, \-\-help |
| 99 | Show a summary of the options to ltrace and exit. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 100 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 101 | .I \-i |
| 102 | Print the instruction pointer at the time of the library call. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 103 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 104 | .I \-l, \-\-library filename |
| 105 | Display only the symbols included in the library |
| 106 | .I filename. |
Juan Cespedes | aee0931 | 2007-08-31 18:49:48 +0200 | [diff] [blame] | 107 | Up to 30 library names can be specified with several instances |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 108 | of this option. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 109 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 110 | .I \-L |
| 111 | DON'T display library calls (use it with the |
| 112 | .I \-S |
| 113 | option). |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 114 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 115 | .I \-n, \-\-indent nr |
| 116 | Indent trace output by |
| 117 | .I nr |
| 118 | number of spaces for each new nested call. Using this option makes |
| 119 | the program flow visualization easy to follow. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 120 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 121 | .I \-o, \-\-output filename |
| 122 | Write the trace output to the file |
| 123 | .I filename |
| 124 | rather than to stderr. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 125 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 126 | .I \-p pid |
| 127 | Attach to the process with the process ID |
| 128 | .I pid |
| 129 | and begin tracing. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 130 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 131 | .I \-r |
| 132 | Print a relative timestamp with each line of the trace. |
| 133 | This records the time difference between the beginning of |
| 134 | successive lines. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 135 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 136 | .I \-s strsize |
| 137 | Specify the maximum string size to print (the default is 32). |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 138 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 139 | .I \-S |
| 140 | Display system calls as well as library calls |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 141 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 142 | .I \-t |
| 143 | Prefix each line of the trace with the time of day. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 144 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 145 | .I \-tt |
| 146 | If given twice, the time printed will include the microseconds. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 147 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 148 | .I \-ttt |
| 149 | If given thrice, the time printed will include the microseconds and |
| 150 | the leading portion will be printed as the number of seconds since the |
| 151 | epoch. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 152 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 153 | .I \-T |
| 154 | Show the time spent inside each call. This records the time difference |
| 155 | between the beginning and the end of each call. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 156 | .TP |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 157 | .I \-u username |
| 158 | Run command with the userid, groupid and supplementary groups of |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 159 | .IR username . |
Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 160 | This option is only useful when running as root and enables the |
| 161 | correct execution of setuid and/or setgid binaries. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 162 | .TP |
| 163 | .I \-X extern |
| 164 | Some architectures need to know where to set a breakpoint that will be hit |
| 165 | after the dynamic linker has run. If this flag is used, then the breakpoint |
| 166 | is set at |
| 167 | .IR extern , |
Paul Gilliam | be32077 | 2006-04-24 22:06:23 +0200 | [diff] [blame] | 168 | which must be an external function. By default, '_start' is used. |
| 169 | NOTE: this flag is only available on the architectures that need it. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 170 | .TP |
| 171 | .I \-x extern |
| 172 | Trace the external function |
| 173 | .IR extern . |
| 174 | This option may be repeated. |
| 175 | .TP |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 176 | .I \-V, \-\-version |
| 177 | Show the version number of ltrace and exit. |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 178 | |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 179 | .SH BUGS |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 180 | It has most of the bugs stated in |
| 181 | .BR strace(1) . |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 182 | .LP |
| 183 | Manual page and documentation are not very up-to-date. |
| 184 | .LP |
| 185 | Option -f sometimes fails to trace some children. |
| 186 | .LP |
Juan Cespedes | 5c3fe06 | 2004-06-14 18:08:37 +0200 | [diff] [blame] | 187 | It only works on Linux and in a small subset of architectures. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 188 | .LP |
Juan Cespedes | b1dd77d | 2002-03-03 00:22:06 +0100 | [diff] [blame] | 189 | Only ELF32 binaries are supported. |
Ian Wienand | 4128b9d | 2006-02-20 22:54:19 +0100 | [diff] [blame] | 190 | .LP |
| 191 | Calls to dlopen()ed libraries will not be traced. |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 192 | .PP |
Steve Fink | 7ab8df1 | 2006-08-07 04:06:16 +0200 | [diff] [blame] | 193 | If you would like to report a bug, send a message to the mailing list |
| 194 | (ltrace-devel@lists.alioth.debian.org), or use the |
Ian Wienand | bf312a1 | 2006-02-20 23:28:35 +0100 | [diff] [blame] | 195 | .BR reportbug(1) |
Juan Cespedes | ac3db29 | 1998-04-25 14:31:58 +0200 | [diff] [blame] | 196 | program if you are under the Debian GNU/Linux distribution. |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 197 | |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 198 | .SH FILES |
| 199 | .TP |
Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 200 | .I /etc/ltrace.conf |
| 201 | System configuration file |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 202 | .TP |
Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 203 | .I ~/.ltrace.conf |
| 204 | Personal config file, overrides |
| 205 | .I /etc/ltrace.conf |
| 206 | |
Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 207 | .SH AUTHOR |
Juan Cespedes | 64e793b | 1997-09-11 23:22:36 +0200 | [diff] [blame] | 208 | Juan Cespedes <cespedes@debian.org> |
Juan Cespedes | 07461b6 | 1997-08-22 15:29:10 +0200 | [diff] [blame] | 209 | |
| 210 | .SH "SEE ALSO" |
| 211 | .BR strace(1) , |
| 212 | .BR ptrace(2) |
| 213 | |