2008-10-31 15:37:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
prefix=@prefix@
|
|
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
|
|
|
|
|
|
nofile=
|
|
|
|
|
silent=
|
|
|
|
|
|
|
|
|
|
skip=1
|
|
|
|
|
while test $skip -eq 1; do
|
|
|
|
|
skip=0
|
|
|
|
|
case $1 in
|
|
|
|
|
--silent)
|
|
|
|
|
skip=1
|
|
|
|
|
silent=1
|
|
|
|
|
;;
|
|
|
|
|
--no-file)
|
|
|
|
|
skip=1
|
|
|
|
|
nofile=1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
if test $skip -eq 1; then
|
|
|
|
|
shift
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if test $# -eq 0; then
|
|
|
|
|
cat << EOF
|
|
|
|
|
usage: cairo-trace [--no-file|--silent] 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:
|
|
|
|
|
--silent - disables the overriding of stdout by cairo-trace.
|
|
|
|
|
The trace file is still generated, but your application
|
|
|
|
|
is free to continue to use stdout.
|
|
|
|
|
--no-file - disables the generation of an output file
|
|
|
|
|
|
|
|
|
|
Enviroment variables understood by cairo-trace:
|
|
|
|
|
CAIRO_TRACE_FLUSH - flush the output after every function call.
|
|
|
|
|
EOF
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#echo $*
|
|
|
|
|
|
|
|
|
|
filename=""
|
|
|
|
|
if test -z "$nofile"; then
|
|
|
|
|
filename=`basename $1`.$$.trace
|
|
|
|
|
fi
|
|
|
|
|
|
2008-11-03 23:23:09 +00:00
|
|
|
LD_PRELOAD=@libdir@/cairo/cairo-trace.so
|
|
|
|
|
export LD_PRELOAD
|
|
|
|
|
|
|
|
|
|
# Force the decimal output to the 'C' locale
|
|
|
|
|
LC_ALL=C
|
|
|
|
|
export LC_ALL
|
|
|
|
|
|
2008-10-31 15:37:58 +00:00
|
|
|
if test -z "$filename"; then
|
2008-11-03 23:23:09 +00:00
|
|
|
CAIRO_TRACE_FD=3 $* 3>&1 >/dev/null
|
2008-10-31 15:37:58 +00:00
|
|
|
elif test -n "$silent"; then
|
2008-11-03 23:23:09 +00:00
|
|
|
CAIRO_TRACE_OUTFILE_EXACT=$filename $*
|
2008-10-31 15:37:58 +00:00
|
|
|
else
|
2008-11-03 23:23:09 +00:00
|
|
|
CAIRO_TRACE_FD=3 $* 3>&1 >/dev/null | tee $filename
|
2008-10-31 15:37:58 +00:00
|
|
|
fi
|