/usr/bin/cairo-trace is in cairo-perf-utils 1.13.0~20140204-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | #!/bin/sh
prefix=/usr
exec_prefix=${prefix}
nofile=
flush=
nocallers=
nomarkdirty=
compress=
usage() {
cat << EOF
usage: cairo-trace [--no-file] command
cairo-trace will generate a log of all calls made by command to
cairo. This log will be stored in a file in the local directory
called command.pid.trace.
Whatever else happens is driven by its argument:
--flush - Flush the output trace after every call.
--no-file - Disable the creation of an output file. Outputs to the
terminal instead.
--no-callers - Do not lookup the caller address/symbol/line whilst tracing.
--mark-dirty - Record image data for cairo_mark_dirty() [default]
--no-mark-dirty - Do not record image data for cairo_mark_dirty()
--compress - Compress the output with LZMA
--profile - Combine --no-callers and --no-mark-dirty and --compress
Environment variables understood by cairo-trace:
CAIRO_TRACE_FLUSH - flush the output after every function call.
CAIRO_TRACE_LINE_INFO - emit line information for most function calls.
EOF
exit
}
skip=1
while test $skip -eq 1; do
skip=0
case $1 in
--flush)
skip=1
flush=1
;;
--no-file)
skip=1
nofile=1
;;
--no-callers)
skip=1
nocallers=1
;;
--mark-dirty)
skip=1
nomarkdirty=
;;
--no-mark-dirty)
skip=1
nomarkdirty=1
;;
--compress)
skip=1
compress=1
nofile=1
;;
--profile)
skip=1
compress=1
nomarkdirty=1
nocallers=1
nofile=1
;;
--version)
echo "cairo-trace, version 1.13.1."
exit
;;
--help)
usage
;;
esac
if test $skip -eq 1; then
shift
fi
done
if test $# -eq 0; then
usage
fi
CAIRO_TRACE_PROG_NAME="$1"
export CAIRO_TRACE_PROG_NAME
if test "x$CAIRO_TRACE_SO" = "x"; then
CAIRO_TRACE_SO=""
for lib in ${prefix}/lib/x86_64-linux-gnu/cairo/libcairo-trace.so ${prefix}/lib/x86_64-linux-gnu/cairo/libcairo-trace.so* ${prefix}/lib/x86_64-linux-gnu/cairo/libcairo-trace.*.so ; do
if test -h "$lib" -o -f "$lib"; then
CAIRO_TRACE_SO="$lib"
break
fi
done
fi
if test "x$CAIRO_TRACE_SO" = "x"; then
echo "Could not find the cairo-trace shared library in ${prefix}/lib/x86_64-linux-gnu/cairo/." >&2
echo "Set the CAIRO_TRACE_SO environment variable to the full path of the library." >&2
exit 15
fi
LD_PRELOAD="$CAIRO_TRACE_SO"
DYLD_INSERT_LIBRARIES="$CAIRO_TRACE_SO"
DYLD_FORCE_FLAT_NAMESPACE=1
export LD_PRELOAD
export DYLD_INSERT_LIBRARIES
export DYLD_FORCE_FLAT_NAMESPACE
if test -n "$nocallers"; then
CAIRO_TRACE_LINE_INFO=0
export CAIRO_TRACE_LINE_INFO
fi
if test -n "$nomarkdirty"; then
CAIRO_TRACE_MARK_DIRTY=0
export CAIRO_TRACE_MARK_DIRTY
fi
if test -n "$flush"; then
CAIRO_TRACE_FLUSH=1
export CAIRO_TRACE_FLUSH
fi
if test -z "$nofile"; then
CAIRO_TRACE_OUTDIR=`pwd` "$@"
elif test -n "$compress"; then
name=`basename $1`
echo Generating compressed trace file $name.$$.lzma
CAIRO_TRACE_FD=3 "$@" 3>&1 >/dev/null | lzma -cz9 > $name.$$.lzma
else
CAIRO_TRACE_FD=3 "$@" 3>&1 >/dev/null
fi
|