Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (50 sloc) 2.83 KB
.TH pretrace 8 "December 12, 2005" "version 0.3"
pretrace \- always run certain executables under a debugging environment
pretrace is a preload library which intercepts the running of executables at loading time and can adjust the environment so that they are run under a debugger, such as strace(1). pretrace is designed to make tracing and debugging applications that may not be easily accessible simpler, for example, debugging apache without having to edit the startup scripts in any way. It also aids in passive auditing by allowing a configurable percentange of calls to be traced, but the others left untouched.
In order to use pretrace, the dynamic loader must be configured to use it by adding the full path to libpretrace to the preload configuration file,
.I /etc/
The format of this configuration file is described in
The configuration file,
.I /etc/pretrace.conf
, should have one application per line, followed by an optional percentage and a debugger command.
.B /path/to/application[%percent][:/path/to/debugger [arg1] [...]]
The percentage is optional, and specifies what percentage of invocations will be traced. If not specified, the default is %100, or all invocations. The application may be followed by a colon and debugger command under which the executable will be launched.
For performance reasons, pretrace will not parse the configuration file on every invocation, but memory map the machine readable version generated when executing ptgenmap(1). For this reason you must execute ptgenmap for changes to the configuration file to take effect.
.B /bin/ls:/usr/bin/strace -f -efile -o/home/user/ls.logfile
Always execute /bin/ls under the strace debugging utility, saving the output to /home/user/ls.logfile. strace will follow forks, and only log information about file related system calls.
.B /usr/bin/fetchmail:/usr/bin/ltrace -f
Always execute fetchmail under the ltrace debugging facility, following forks. ltrace will print it's output to standard error.
.B /usr/bin/xcalc%75:/usr/bin/valgrind --tool=memcheck --trace-children=yes --log-file=xcalc
75% of the invocations of xcalc will be traced under the valgrind memory debugger.
.B /usr/bin/xterm
All invocations of xterm will be logged using the default debugger, set at compile time.
pretrace should execute transparently. In the event of an error pretrace will attempt to cleanly hand control over to the application. A debugging message may be printed to standard error.
.B /etc/pretrace.conf
\- configuration file for libpretrace.
.B /etc/
\- machine readable configuration file, as created by ptgenmap.
Tavis Ormandy <> and Rob Holland <>
Jump to Line
Something went wrong with that request. Please try again.