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