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